From 94fd8de4263dc6294aa62425a5f98d905ef0584a Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 25 Dec 2019 03:35:14 -0800 Subject: Update quick_tour with cookiecutter master branch --- docs/quick_tour/logging/pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/quick_tour/logging') diff --git a/docs/quick_tour/logging/pytest.ini b/docs/quick_tour/logging/pytest.ini index f707d54e4..b419855e1 100644 --- a/docs/quick_tour/logging/pytest.ini +++ b/docs/quick_tour/logging/pytest.ini @@ -1,3 +1,3 @@ [pytest] testpaths = hello_world -python_files = *.py +python_files = test*.py -- cgit v1.2.3 From c86c61bfbab809d55b8d1a53e4a2b47505317720 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 25 Dec 2019 23:45:57 -0800 Subject: Use package name instead of relative path for the renderer --- docs/quick_tour/logging/hello_world/views/default.py | 2 +- docs/quick_tour/logging/hello_world/views/notfound.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/quick_tour/logging') 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 {} -- cgit v1.2.3 From f61a292939d2a41598f45fc8f908343eb8859e23 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Fri, 27 Dec 2019 02:47:04 -0800 Subject: Update tests.py with 100% coverage --- docs/quick_tour/logging/hello_world/tests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'docs/quick_tour/logging') diff --git a/docs/quick_tour/logging/hello_world/tests.py b/docs/quick_tour/logging/hello_world/tests.py index f01ae2a3c..b747e7679 100644 --- a/docs/quick_tour/logging/hello_world/tests.py +++ b/docs/quick_tour/logging/hello_world/tests.py @@ -16,6 +16,12 @@ class ViewTests(unittest.TestCase): info = my_view(request) self.assertEqual(info['project'], 'hello_world') + 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) -- cgit v1.2.3 From 80e9923262fee4892a750d0d6366b193cb4204ba Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 1 Jan 2020 17:40:46 -0800 Subject: Resync through Quick Tour after moving tests directory --- docs/quick_tour/logging/MANIFEST.in | 3 +++ docs/quick_tour/logging/pytest.ini | 2 +- docs/quick_tour/logging/tests/__init__.py | 0 docs/quick_tour/logging/tests/test_it.py | 39 +++++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 docs/quick_tour/logging/tests/__init__.py create mode 100644 docs/quick_tour/logging/tests/test_it.py (limited to 'docs/quick_tour/logging') 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/pytest.ini b/docs/quick_tour/logging/pytest.ini index b419855e1..f707d54e4 100644 --- a/docs/quick_tour/logging/pytest.ini +++ b/docs/quick_tour/logging/pytest.ini @@ -1,3 +1,3 @@ [pytest] testpaths = hello_world -python_files = test*.py +python_files = *.py 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 diff --git a/docs/quick_tour/logging/tests/test_it.py b/docs/quick_tour/logging/tests/test_it.py new file mode 100644 index 000000000..90c6302fe --- /dev/null +++ b/docs/quick_tour/logging/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) -- cgit v1.2.3 From 3157775a08ff9e48b0fff8057f4482d78d266f01 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 1 Jan 2020 18:16:30 -0800 Subject: Resync through Quick Tour after moving tests directory, removing tests.py file --- docs/quick_tour/logging/hello_world/tests.py | 39 ---------------------------- 1 file changed, 39 deletions(-) delete mode 100644 docs/quick_tour/logging/hello_world/tests.py (limited to 'docs/quick_tour/logging') diff --git a/docs/quick_tour/logging/hello_world/tests.py b/docs/quick_tour/logging/hello_world/tests.py deleted file mode 100644 index b747e7679..000000000 --- a/docs/quick_tour/logging/hello_world/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'], 'hello_world') - - 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 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) -- 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_tour/logging/.coveragerc | 1 - 1 file changed, 1 deletion(-) (limited to 'docs/quick_tour/logging') 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* -- 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_tour/logging/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/quick_tour/logging') 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={ -- cgit v1.2.3