Browse Source

Update minitwit & improve testing for examples (#1954)

* Update minitwit & improve testing for examples

* Related to #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
pull/2000/head
Kyle Lawlor 8 years ago committed by Markus Unterwaditzer
parent
commit
5f009374fd
  1. 6
      examples/flaskr/tests/context.py
  2. 4
      examples/flaskr/tests/test_flaskr.py
  3. 2
      examples/minitwit/.gitignore
  4. 3
      examples/minitwit/MANIFEST.in
  5. 2
      examples/minitwit/README
  6. 1
      examples/minitwit/minitwit/__init__.py
  7. 0
      examples/minitwit/minitwit/minitwit.py
  8. 0
      examples/minitwit/minitwit/schema.sql
  9. 0
      examples/minitwit/minitwit/static/style.css
  10. 0
      examples/minitwit/minitwit/templates/layout.html
  11. 0
      examples/minitwit/minitwit/templates/login.html
  12. 0
      examples/minitwit/minitwit/templates/register.html
  13. 0
      examples/minitwit/minitwit/templates/timeline.html
  14. 2
      examples/minitwit/setup.cfg
  15. 16
      examples/minitwit/setup.py
  16. 2
      examples/minitwit/tests/test_minitwit.py
  17. 2
      setup.cfg

6
examples/flaskr/tests/context.py

@ -1,6 +0,0 @@
import sys, os
basedir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, basedir + '/../')
from flaskr import flaskr

4
examples/flaskr/tests/test_flaskr.py

@ -9,11 +9,11 @@
:license: BSD, see LICENSE for more details.
"""
import pytest
import os
import tempfile
import pytest
from flaskr import flaskr
from context import flaskr
@pytest.fixture
def client(request):

2
examples/minitwit/.gitignore vendored

@ -0,0 +1,2 @@
minitwit.db
.eggs/

3
examples/minitwit/MANIFEST.in

@ -0,0 +1,3 @@
graft minitwit/templates
graft minitwit/static
include minitwit/schema.sql

2
examples/minitwit/README

@ -31,5 +31,5 @@
~ Is it tested?
You betcha. Run the `test_minitwit.py` file to
You betcha. Run the `python setup.py test` file to
see the tests pass.

1
examples/minitwit/minitwit/__init__.py

@ -0,0 +1 @@
from minitwit import app

0
examples/minitwit/minitwit.py → examples/minitwit/minitwit/minitwit.py

0
examples/minitwit/schema.sql → examples/minitwit/minitwit/schema.sql

0
examples/minitwit/static/style.css → examples/minitwit/minitwit/static/style.css

0
examples/minitwit/templates/layout.html → examples/minitwit/minitwit/templates/layout.html

0
examples/minitwit/templates/login.html → examples/minitwit/minitwit/templates/login.html

0
examples/minitwit/templates/register.html → examples/minitwit/minitwit/templates/register.html

0
examples/minitwit/templates/timeline.html → examples/minitwit/minitwit/templates/timeline.html

2
examples/minitwit/setup.cfg

@ -0,0 +1,2 @@
[aliases]
test=pytest

16
examples/minitwit/setup.py

@ -0,0 +1,16 @@
from setuptools import setup
setup(
name='minitwit',
packages=['minitwit'],
include_package_data=True,
install_requires=[
'flask',
],
setup_requires=[
'pytest-runner',
],
tests_require=[
'pytest',
],
)

2
examples/minitwit/test_minitwit.py → examples/minitwit/tests/test_minitwit.py

@ -9,9 +9,9 @@
:license: BSD, see LICENSE for more details.
"""
import os
import minitwit
import tempfile
import pytest
from minitwit import minitwit
@pytest.fixture

2
setup.cfg

@ -5,4 +5,4 @@ release = egg_info -RDb ''
universal = 1
[pytest]
norecursedirs = .* *.egg *.egg-info env* artwork docs
norecursedirs = .* *.egg *.egg-info env* artwork docs examples

Loading…
Cancel
Save