Skip to content

Commit 5f00937

Browse files
wgwzuntitaker
authored andcommitted
Update minitwit & improve testing for examples (pallets#1954)
* Update minitwit & improve testing for examples * Related to pallets#1945 * Re-works minitwit to be installed and run as: pip install --editable . export FLASK_APP=minitwit.minitwit export FLASK_DEBUG=1 flask initdb flask run * added flaskr and minitwit to norecursedirs * tests not properly run when using pytest standards * see: http://stackoverflow.com/questions/38313171/configuring-pytest-with-installable-examples-in-a-project * Both flaskr and minitwit now follow pytest standards. * Tests can for them as `py.test` or `python setup.py test` * Update minitwit readme * updates the instructions for running * Fixes for updating the minitwit example - This reverts the changes to the *docs/* (I will file separate PR). - Running the app is now: `export FLASK_APP=minitwit` & `flask run` (After installing the app) * Remove unnecessary comma from flaskr/setup.py
1 parent 1e5746b commit 5f00937

File tree

17 files changed

+29
-11
lines changed

17 files changed

+29
-11
lines changed

examples/flaskr/tests/context.py

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/flaskr/tests/test_flaskr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
:license: BSD, see LICENSE for more details.
1010
"""
1111

12-
import pytest
1312
import os
1413
import tempfile
14+
import pytest
15+
from flaskr import flaskr
1516

16-
from context import flaskr
1717

1818
@pytest.fixture
1919
def client(request):

examples/minitwit/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
minitwit.db
2+
.eggs/

examples/minitwit/MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
graft minitwit/templates
2+
graft minitwit/static
3+
include minitwit/schema.sql

examples/minitwit/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131

3232
~ Is it tested?
3333

34-
You betcha. Run the `test_minitwit.py` file to
34+
You betcha. Run the `python setup.py test` file to
3535
see the tests pass.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from minitwit import app
File renamed without changes.

examples/minitwit/setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[aliases]
2+
test=pytest

examples/minitwit/setup.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from setuptools import setup
2+
3+
setup(
4+
name='minitwit',
5+
packages=['minitwit'],
6+
include_package_data=True,
7+
install_requires=[
8+
'flask',
9+
],
10+
setup_requires=[
11+
'pytest-runner',
12+
],
13+
tests_require=[
14+
'pytest',
15+
],
16+
)

examples/minitwit/test_minitwit.py renamed to examples/minitwit/tests/test_minitwit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
:license: BSD, see LICENSE for more details.
1010
"""
1111
import os
12-
import minitwit
1312
import tempfile
1413
import pytest
14+
from minitwit import minitwit
1515

1616

1717
@pytest.fixture

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ release = egg_info -RDb ''
55
universal = 1
66

77
[pytest]
8-
norecursedirs = .* *.egg *.egg-info env* artwork docs
8+
norecursedirs = .* *.egg *.egg-info env* artwork docs examples

0 commit comments

Comments
 (0)