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 From dece4d25b136a493dfeeeb516487d4d756bc69e9 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 1 Jan 2020 18:27:30 -0800 Subject: Resync through project.rst after moving tests directory --- docs/narr/myproject/MANIFEST.in | 3 +++ docs/narr/myproject/myproject/tests.py | 39 ---------------------------------- docs/narr/myproject/pytest.ini | 7 ++++-- docs/narr/myproject/tests/__init__.py | 0 docs/narr/myproject/tests/test_it.py | 39 ++++++++++++++++++++++++++++++++++ 5 files changed, 47 insertions(+), 41 deletions(-) delete mode 100644 docs/narr/myproject/myproject/tests.py create mode 100644 docs/narr/myproject/tests/__init__.py create mode 100644 docs/narr/myproject/tests/test_it.py (limited to 'docs/narr/myproject') diff --git a/docs/narr/myproject/MANIFEST.in b/docs/narr/myproject/MANIFEST.in index 1c24b8c0c..f516697f5 100644 --- a/docs/narr/myproject/MANIFEST.in +++ b/docs/narr/myproject/MANIFEST.in @@ -1,2 +1,5 @@ include *.txt *.ini *.cfg *.rst recursive-include myproject *.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/narr/myproject/myproject/tests.py b/docs/narr/myproject/myproject/tests.py deleted file mode 100644 index 48f0095ad..000000000 --- a/docs/narr/myproject/myproject/tests.py +++ /dev/null @@ -1,39 +0,0 @@ -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 .views.default import my_view - request = testing.DummyRequest() - info = my_view(request) - 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): - def setUp(self): - from myproject 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) diff --git a/docs/narr/myproject/pytest.ini b/docs/narr/myproject/pytest.ini index 332cf0d04..5c8c59068 100644 --- a/docs/narr/myproject/pytest.ini +++ b/docs/narr/myproject/pytest.ini @@ -1,3 +1,6 @@ [pytest] -testpaths = myproject -python_files = test*.py +addopts = --strict + +testpaths = + myproject + tests diff --git a/docs/narr/myproject/tests/__init__.py b/docs/narr/myproject/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/docs/narr/myproject/tests/test_it.py b/docs/narr/myproject/tests/test_it.py new file mode 100644 index 000000000..b300da34d --- /dev/null +++ b/docs/narr/myproject/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 myproject.views.default import my_view + request = testing.DummyRequest() + info = my_view(request) + self.assertEqual(info['project'], 'myproject') + + def test_notfound_view(self): + from myproject.views.notfound import notfound_view + request = testing.DummyRequest() + info = notfound_view(request) + self.assertEqual(info, {}) + + +class FunctionalTests(unittest.TestCase): + def setUp(self): + from myproject 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) -- cgit v1.2.3 From b8cc2a85919757bcf5582c683eaff7d384cdfa03 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 1 Jan 2020 23:07:32 -0800 Subject: Resynch docs with cookiecutter - remove unnecessary `omit` line in .coveragerc --- docs/narr/myproject/.coveragerc | 1 - 1 file changed, 1 deletion(-) (limited to 'docs/narr/myproject') diff --git a/docs/narr/myproject/.coveragerc b/docs/narr/myproject/.coveragerc index f0c31d6d7..5837f5504 100644 --- a/docs/narr/myproject/.coveragerc +++ b/docs/narr/myproject/.coveragerc @@ -1,3 +1,2 @@ [run] source = myproject -omit = myproject/test* -- cgit v1.2.3 From b349c2ba948148d2f5441308c6646f624100b364 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Fri, 3 Jan 2020 22:59:27 -0600 Subject: exclude tests package from source packages --- docs/narr/myproject/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/narr/myproject') diff --git a/docs/narr/myproject/setup.py b/docs/narr/myproject/setup.py index 40aa2c53b..e5872df29 100644 --- a/docs/narr/myproject/setup.py +++ b/docs/narr/myproject/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={ -- cgit v1.2.3