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
This commit is contained in:
Kyle Lawlor 2016-08-22 14:52:54 -04:00 committed by Markus Unterwaditzer
parent 1e5746bb2b
commit 5f009374fd
17 changed files with 29 additions and 11 deletions

View file

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

View file

@ -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 Normal file
View file

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

View file

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

View file

@ -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.

View file

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

View file

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

View file

@ -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',
],
)

View file

@ -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

View file

@ -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