diff options
| author | Steve Piercy <web@stevepiercy.com> | 2020-01-01 17:40:46 -0800 |
|---|---|---|
| committer | Steve Piercy <web@stevepiercy.com> | 2020-01-02 23:30:59 -0800 |
| commit | 80e9923262fee4892a750d0d6366b193cb4204ba (patch) | |
| tree | 66a8156cb8be070a437c847a425101b648f690ce /docs/quick_tour/package | |
| parent | 8b2bb44114e3a724d66035e76051a6910e14657e (diff) | |
| download | pyramid-80e9923262fee4892a750d0d6366b193cb4204ba.tar.gz pyramid-80e9923262fee4892a750d0d6366b193cb4204ba.tar.bz2 pyramid-80e9923262fee4892a750d0d6366b193cb4204ba.zip | |
Resync through Quick Tour after moving tests directory
Diffstat (limited to 'docs/quick_tour/package')
| -rw-r--r-- | docs/quick_tour/package/MANIFEST.in | 3 | ||||
| -rw-r--r-- | docs/quick_tour/package/pytest.ini | 2 | ||||
| -rw-r--r-- | docs/quick_tour/package/tests/__init__.py | 0 | ||||
| -rw-r--r-- | docs/quick_tour/package/tests/test_it.py | 39 |
4 files changed, 43 insertions, 1 deletions
diff --git a/docs/quick_tour/package/MANIFEST.in b/docs/quick_tour/package/MANIFEST.in index a75da6dad..7a73762f7 100644 --- a/docs/quick_tour/package/MANIFEST.in +++ b/docs/quick_tour/package/MANIFEST.in @@ -1,2 +1,5 @@ include *.txt *.ini *.cfg *.rst recursive-include hello_world *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2 +recursive-include tests * +recursive-exclude * __pycache__ +recursive-exclude * *.py[co] diff --git a/docs/quick_tour/package/pytest.ini b/docs/quick_tour/package/pytest.ini index b419855e1..f707d54e4 100644 --- a/docs/quick_tour/package/pytest.ini +++ b/docs/quick_tour/package/pytest.ini @@ -1,3 +1,3 @@ [pytest] testpaths = hello_world -python_files = test*.py +python_files = *.py diff --git a/docs/quick_tour/package/tests/__init__.py b/docs/quick_tour/package/tests/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/docs/quick_tour/package/tests/__init__.py diff --git a/docs/quick_tour/package/tests/test_it.py b/docs/quick_tour/package/tests/test_it.py new file mode 100644 index 000000000..90c6302fe --- /dev/null +++ b/docs/quick_tour/package/tests/test_it.py @@ -0,0 +1,39 @@ +import unittest + +from pyramid import testing + + +class ViewTests(unittest.TestCase): + def setUp(self): + self.config = testing.setUp() + + def tearDown(self): + testing.tearDown() + + def test_my_view(self): + from hello_world.views.default import my_view + request = testing.DummyRequest() + info = my_view(request) + self.assertEqual(info['project'], 'hello_world') + + def test_notfound_view(self): + from hello_world.views.notfound import notfound_view + request = testing.DummyRequest() + info = notfound_view(request) + self.assertEqual(info, {}) + + +class FunctionalTests(unittest.TestCase): + def setUp(self): + from hello_world import main + app = main({}) + from webtest import TestApp + self.testapp = TestApp(app) + + def test_root(self): + res = self.testapp.get('/', status=200) + self.assertTrue(b'Pyramid' in res.body) + + def test_notfound(self): + res = self.testapp.get('/badurl', status=404) + self.assertTrue(res.status_code == 404) |
