From 1ca5432b80167f2da57c54e5050b977da9e191ed Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Fri, 27 Dec 2019 04:01:17 -0800 Subject: Update project.rst and its cookiecutter project files - Update output to reflect current cookiecutter - Fix minor typos - Use new links to PyPA for MANIFEST.in description and usage - Add missing keyword "keywords" to setup.py whirlwind description - Flip order of `install_requires` and `extras_require` to align with order in setup.py - Update line numbers and code references - Add watchman under hupper and rewrite paragraph @mmerickel should review --- docs/narr/myproject/README.txt | 4 ++-- docs/narr/myproject/myproject/tests.py | 12 +++++++++++- docs/narr/myproject/myproject/views/default.py | 2 +- docs/narr/myproject/myproject/views/notfound.py | 2 +- docs/narr/myproject/pytest.ini | 2 +- docs/narr/myproject/setup.py | 2 +- 6 files changed, 17 insertions(+), 7 deletions(-) (limited to 'docs/narr/myproject') diff --git a/docs/narr/myproject/README.txt b/docs/narr/myproject/README.txt index 2ffc0acba..6c5a0fee0 100644 --- a/docs/narr/myproject/README.txt +++ b/docs/narr/myproject/README.txt @@ -1,4 +1,4 @@ -MyProject +myproject ========= Getting Started @@ -6,7 +6,7 @@ Getting Started - Change directory into your newly created project. - cd MyProject + cd myproject - Create a Python virtual environment. diff --git a/docs/narr/myproject/myproject/tests.py b/docs/narr/myproject/myproject/tests.py index 05ccadcfb..48f0095ad 100644 --- a/docs/narr/myproject/myproject/tests.py +++ b/docs/narr/myproject/myproject/tests.py @@ -14,7 +14,13 @@ class ViewTests(unittest.TestCase): from .views.default import my_view request = testing.DummyRequest() info = my_view(request) - self.assertEqual(info['project'], 'MyProject') + self.assertEqual(info['project'], 'myproject') + + def test_notfound_view(self): + from .views.notfound import notfound_view + request = testing.DummyRequest() + info = notfound_view(request) + self.assertEqual(info, {}) class FunctionalTests(unittest.TestCase): @@ -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) diff --git a/docs/narr/myproject/myproject/views/default.py b/docs/narr/myproject/myproject/views/default.py index 8324cfe32..619ce1c0f 100644 --- a/docs/narr/myproject/myproject/views/default.py +++ b/docs/narr/myproject/myproject/views/default.py @@ -1,6 +1,6 @@ from pyramid.view import view_config -@view_config(route_name='home', renderer='../templates/mytemplate.jinja2') +@view_config(route_name='home', renderer='myproject:templates/mytemplate.jinja2') def my_view(request): return {'project': 'myproject'} diff --git a/docs/narr/myproject/myproject/views/notfound.py b/docs/narr/myproject/myproject/views/notfound.py index 69d6e2804..5abebb277 100644 --- a/docs/narr/myproject/myproject/views/notfound.py +++ b/docs/narr/myproject/myproject/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='myproject:templates/404.jinja2') def notfound_view(request): request.response.status = 404 return {} diff --git a/docs/narr/myproject/pytest.ini b/docs/narr/myproject/pytest.ini index b1b5f4c38..332cf0d04 100644 --- a/docs/narr/myproject/pytest.ini +++ b/docs/narr/myproject/pytest.ini @@ -1,3 +1,3 @@ [pytest] testpaths = myproject -python_files = *.py +python_files = test*.py diff --git a/docs/narr/myproject/setup.py b/docs/narr/myproject/setup.py index 1ee272270..40aa2c53b 100644 --- a/docs/narr/myproject/setup.py +++ b/docs/narr/myproject/setup.py @@ -25,7 +25,7 @@ tests_require = [ setup( name='myproject', version='0.0', - description='MyProject', + description='myproject', long_description=README + '\n\n' + CHANGES, classifiers=[ 'Programming Language :: Python', -- cgit v1.2.3