diff options
| author | Michael Merickel <michael@merickel.org> | 2020-01-03 23:14:26 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-03 23:14:26 -0600 |
| commit | 148cf5138638ce6b1b92b4e13fe1444df9451e34 (patch) | |
| tree | 7b088836b570b401caf510f130f144404cb19ca4 /docs/quick_tour/logging | |
| parent | cc396692d82441f8142fb14041542ebd2dad6f0a (diff) | |
| parent | b349c2ba948148d2f5441308c6646f624100b364 (diff) | |
| download | pyramid-148cf5138638ce6b1b92b4e13fe1444df9451e34.tar.gz pyramid-148cf5138638ce6b1b92b4e13fe1444df9451e34.tar.bz2 pyramid-148cf5138638ce6b1b92b4e13fe1444df9451e34.zip | |
Merge pull request #3556 from stevepiercy/docs-synch-cookiecutter-pr-71
Update docs to sync with cookiecutter master branch
Diffstat (limited to 'docs/quick_tour/logging')
| -rw-r--r-- | docs/quick_tour/logging/.coveragerc | 1 | ||||
| -rw-r--r-- | docs/quick_tour/logging/MANIFEST.in | 3 | ||||
| -rw-r--r-- | docs/quick_tour/logging/hello_world/views/default.py | 2 | ||||
| -rw-r--r-- | docs/quick_tour/logging/hello_world/views/notfound.py | 2 | ||||
| -rw-r--r-- | docs/quick_tour/logging/setup.py | 2 | ||||
| -rw-r--r-- | docs/quick_tour/logging/tests/__init__.py | 0 | ||||
| -rw-r--r-- | docs/quick_tour/logging/tests/test_it.py (renamed from docs/quick_tour/logging/hello_world/tests.py) | 12 |
7 files changed, 17 insertions, 5 deletions
diff --git a/docs/quick_tour/logging/.coveragerc b/docs/quick_tour/logging/.coveragerc index 128e26410..a94933b5f 100644 --- a/docs/quick_tour/logging/.coveragerc +++ b/docs/quick_tour/logging/.coveragerc @@ -1,3 +1,2 @@ [run] source = hello_world -omit = hello_world/test* diff --git a/docs/quick_tour/logging/MANIFEST.in b/docs/quick_tour/logging/MANIFEST.in index a75da6dad..7a73762f7 100644 --- a/docs/quick_tour/logging/MANIFEST.in +++ b/docs/quick_tour/logging/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/logging/hello_world/views/default.py b/docs/quick_tour/logging/hello_world/views/default.py index bbb99d78c..4bbc01e11 100644 --- a/docs/quick_tour/logging/hello_world/views/default.py +++ b/docs/quick_tour/logging/hello_world/views/default.py @@ -3,7 +3,7 @@ from pyramid.view import view_config import logging log = logging.getLogger(__name__) -@view_config(route_name='home', renderer='../templates/mytemplate.jinja2') +@view_config(route_name='home', renderer='hello_world:templates/mytemplate.jinja2') def my_view(request): log.debug('Some Message') return {'project': 'hello_world'} diff --git a/docs/quick_tour/logging/hello_world/views/notfound.py b/docs/quick_tour/logging/hello_world/views/notfound.py index 69d6e2804..6d0ff4193 100644 --- a/docs/quick_tour/logging/hello_world/views/notfound.py +++ b/docs/quick_tour/logging/hello_world/views/notfound.py @@ -1,7 +1,7 @@ from pyramid.view import notfound_view_config -@notfound_view_config(renderer='../templates/404.jinja2') +@notfound_view_config(renderer='hello_world:templates/404.jinja2') def notfound_view(request): request.response.status = 404 return {} diff --git a/docs/quick_tour/logging/setup.py b/docs/quick_tour/logging/setup.py index e9c15db04..1fec15ce5 100644 --- a/docs/quick_tour/logging/setup.py +++ b/docs/quick_tour/logging/setup.py @@ -37,7 +37,7 @@ setup( author_email='', url='', keywords='web pyramid pylons', - packages=find_packages(), + packages=find_packages(exclude=['tests']), include_package_data=True, zip_safe=False, extras_require={ diff --git a/docs/quick_tour/logging/tests/__init__.py b/docs/quick_tour/logging/tests/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/docs/quick_tour/logging/tests/__init__.py diff --git a/docs/quick_tour/logging/hello_world/tests.py b/docs/quick_tour/logging/tests/test_it.py index f01ae2a3c..90c6302fe 100644 --- a/docs/quick_tour/logging/hello_world/tests.py +++ b/docs/quick_tour/logging/tests/test_it.py @@ -11,11 +11,17 @@ class ViewTests(unittest.TestCase): testing.tearDown() def test_my_view(self): - from .views.default import my_view + 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): @@ -27,3 +33,7 @@ class FunctionalTests(unittest.TestCase): 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) |
