From f179c23c705afc20026c26bd02d6ae64b8295935 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Fri, 27 Dec 2019 14:39:58 -0800 Subject: Update quick_tutorial/cookiecutters.rst and related files --- docs/quick_tutorial/cookiecutters.rst | 4 ++-- docs/quick_tutorial/cookiecutters/cc_starter/tests.py | 10 ++++++++++ docs/quick_tutorial/cookiecutters/cc_starter/views/default.py | 2 +- docs/quick_tutorial/cookiecutters/cc_starter/views/notfound.py | 2 +- docs/quick_tutorial/cookiecutters/pytest.ini | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) (limited to 'docs/quick_tutorial') diff --git a/docs/quick_tutorial/cookiecutters.rst b/docs/quick_tutorial/cookiecutters.rst index e4a585a33..a1d60c181 100644 --- a/docs/quick_tutorial/cookiecutters.rst +++ b/docs/quick_tutorial/cookiecutters.rst @@ -73,8 +73,8 @@ Steps .. code-block:: text - Starting subprocess with file monitor - Starting server in PID 73732. + Starting monitor for PID 60461. + Starting server in PID 60461. Serving on http://localhost:6543 Serving on http://localhost:6543 diff --git a/docs/quick_tutorial/cookiecutters/cc_starter/tests.py b/docs/quick_tutorial/cookiecutters/cc_starter/tests.py index f3886be84..0891a3c51 100644 --- a/docs/quick_tutorial/cookiecutters/cc_starter/tests.py +++ b/docs/quick_tutorial/cookiecutters/cc_starter/tests.py @@ -16,6 +16,12 @@ class ViewTests(unittest.TestCase): info = my_view(request) self.assertEqual(info['project'], 'cc_starter') + 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): @@ -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/quick_tutorial/cookiecutters/cc_starter/views/default.py b/docs/quick_tutorial/cookiecutters/cc_starter/views/default.py index 47af359b5..21c30e0b2 100644 --- a/docs/quick_tutorial/cookiecutters/cc_starter/views/default.py +++ b/docs/quick_tutorial/cookiecutters/cc_starter/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='cc_starter:templates/mytemplate.jinja2') def my_view(request): return {'project': 'cc_starter'} diff --git a/docs/quick_tutorial/cookiecutters/cc_starter/views/notfound.py b/docs/quick_tutorial/cookiecutters/cc_starter/views/notfound.py index 69d6e2804..e8b8f26f3 100644 --- a/docs/quick_tutorial/cookiecutters/cc_starter/views/notfound.py +++ b/docs/quick_tutorial/cookiecutters/cc_starter/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='cc_starter:templates/404.jinja2') def notfound_view(request): request.response.status = 404 return {} diff --git a/docs/quick_tutorial/cookiecutters/pytest.ini b/docs/quick_tutorial/cookiecutters/pytest.ini index a7bd797f0..326c14fbc 100644 --- a/docs/quick_tutorial/cookiecutters/pytest.ini +++ b/docs/quick_tutorial/cookiecutters/pytest.ini @@ -1,3 +1,3 @@ [pytest] testpaths = cc_starter -python_files = *.py +python_files = test*.py -- cgit v1.2.3 From f2320a274a7168916aeb40cdbc094c4911e5e747 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 1 Jan 2020 19:21:59 -0800 Subject: Resync quick_tutorial/cookiecutters.rst and related files after moving tests directory --- docs/quick_tutorial/cookiecutters/MANIFEST.in | 3 ++ .../cookiecutters/cc_starter/tests.py | 39 ---------------------- docs/quick_tutorial/cookiecutters/pytest.ini | 7 ++-- 3 files changed, 8 insertions(+), 41 deletions(-) delete mode 100644 docs/quick_tutorial/cookiecutters/cc_starter/tests.py (limited to 'docs/quick_tutorial') diff --git a/docs/quick_tutorial/cookiecutters/MANIFEST.in b/docs/quick_tutorial/cookiecutters/MANIFEST.in index 79c7ec16c..4071776f9 100644 --- a/docs/quick_tutorial/cookiecutters/MANIFEST.in +++ b/docs/quick_tutorial/cookiecutters/MANIFEST.in @@ -1,2 +1,5 @@ include *.txt *.ini *.cfg *.rst recursive-include cc_starter *.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_tutorial/cookiecutters/cc_starter/tests.py b/docs/quick_tutorial/cookiecutters/cc_starter/tests.py deleted file mode 100644 index 0891a3c51..000000000 --- a/docs/quick_tutorial/cookiecutters/cc_starter/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'], 'cc_starter') - - 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 cc_starter 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/quick_tutorial/cookiecutters/pytest.ini b/docs/quick_tutorial/cookiecutters/pytest.ini index 326c14fbc..515cc3cf0 100644 --- a/docs/quick_tutorial/cookiecutters/pytest.ini +++ b/docs/quick_tutorial/cookiecutters/pytest.ini @@ -1,3 +1,6 @@ [pytest] -testpaths = cc_starter -python_files = test*.py +addopts = --strict + +testpaths = + cc_starter + tests -- cgit v1.2.3 From f929eace7ec1843712fb1831b834a7966330d43e Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 1 Jan 2020 19:22:43 -0800 Subject: Resync quick_tutorial/cookiecutters.rst and related files after moving tests directory, including tests package --- .../quick_tutorial/cookiecutters/tests/__init__.py | 0 docs/quick_tutorial/cookiecutters/tests/test_it.py | 39 ++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 docs/quick_tutorial/cookiecutters/tests/__init__.py create mode 100644 docs/quick_tutorial/cookiecutters/tests/test_it.py (limited to 'docs/quick_tutorial') diff --git a/docs/quick_tutorial/cookiecutters/tests/__init__.py b/docs/quick_tutorial/cookiecutters/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/docs/quick_tutorial/cookiecutters/tests/test_it.py b/docs/quick_tutorial/cookiecutters/tests/test_it.py new file mode 100644 index 000000000..634abfdf2 --- /dev/null +++ b/docs/quick_tutorial/cookiecutters/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 cc_starter.views.default import my_view + request = testing.DummyRequest() + info = my_view(request) + self.assertEqual(info['project'], 'cc_starter') + + def test_notfound_view(self): + from cc_starter.views.notfound import notfound_view + request = testing.DummyRequest() + info = notfound_view(request) + self.assertEqual(info, {}) + + +class FunctionalTests(unittest.TestCase): + def setUp(self): + from cc_starter 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/quick_tutorial/cookiecutters/.coveragerc | 1 - 1 file changed, 1 deletion(-) (limited to 'docs/quick_tutorial') diff --git a/docs/quick_tutorial/cookiecutters/.coveragerc b/docs/quick_tutorial/cookiecutters/.coveragerc index 1bcbb8c3e..8aa37b9e7 100644 --- a/docs/quick_tutorial/cookiecutters/.coveragerc +++ b/docs/quick_tutorial/cookiecutters/.coveragerc @@ -1,3 +1,2 @@ [run] source = cc_starter -omit = cc_starter/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/quick_tutorial/cookiecutters/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/quick_tutorial') diff --git a/docs/quick_tutorial/cookiecutters/setup.py b/docs/quick_tutorial/cookiecutters/setup.py index d5d3d018b..9c9d54e5b 100644 --- a/docs/quick_tutorial/cookiecutters/setup.py +++ b/docs/quick_tutorial/cookiecutters/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