diff options
Diffstat (limited to 'docs/tutorials/wiki')
60 files changed, 200 insertions, 133 deletions
diff --git a/docs/tutorials/wiki/authorization.rst b/docs/tutorials/wiki/authorization.rst index ef914cab5..2ff9deb31 100644 --- a/docs/tutorials/wiki/authorization.rst +++ b/docs/tutorials/wiki/authorization.rst @@ -99,7 +99,7 @@ Here we use "dummy" data to represent user and groups sources. Add an ACL ~~~~~~~~~~ -Open ``tutorial/models.py`` and add the following import statement near the top: +Open ``tutorial/models/__init__.py`` and add the following import statement near the top: .. literalinclude:: src/authorization/tutorial/models/__init__.py :lines: 4-8 @@ -179,7 +179,7 @@ Open ``tutorial/views/default.py`` and add a ``permission='edit'`` parameter to :language: python .. literalinclude:: src/authorization/tutorial/views/default.py - :lines: 68-70 + :lines: 69-71 :emphasize-lines: 2-3 :language: python @@ -191,12 +191,12 @@ Add a ``permission='view'`` parameter to the ``@view_config`` decorator for ``view_wiki()`` and ``view_page()`` as follows: .. literalinclude:: src/authorization/tutorial/views/default.py - :lines: 23-24 + :lines: 21-22 :emphasize-lines: 1-2 :language: python .. literalinclude:: src/authorization/tutorial/views/default.py - :lines: 28-29 + :lines: 27-28 :emphasize-lines: 1-2 :language: python @@ -318,7 +318,7 @@ Our ``tutorial/__init__.py`` will look like this when we are done: Only the highlighted lines need to be added or edited. -Our ``tutorial/models.py`` will look like this when we are done: +Our ``tutorial/models/__init__.py`` will look like this when we are done: .. literalinclude:: src/authorization/tutorial/models/__init__.py :linenos: diff --git a/docs/tutorials/wiki/basiclayout.rst b/docs/tutorials/wiki/basiclayout.rst index 52d3f4670..4eb5c4283 100644 --- a/docs/tutorials/wiki/basiclayout.rst +++ b/docs/tutorials/wiki/basiclayout.rst @@ -107,6 +107,12 @@ Next include routes from the ``.routes`` module. :lineno-match: :language: py +The included module contains the following function. + +.. literalinclude:: src/basiclayout/tutorial/routes.py + :linenos: + :language: py + This registers a "static view" using the :meth:`pyramid.config.Configurator.add_static_view` method. This view answers requests whose URL path starts with ``/static``. This statement registers a view that will serve up static assets, such as CSS and image files. @@ -121,7 +127,7 @@ Alternatively the cookiecutter could have used an *absolute* asset specification The third argument is an optional ``cache_max_age`` which specifies the number of seconds the static asset will be HTTP-cached. -Next perform a :term:`scan`. +Back into our ``__init__.py``, next perform a :term:`scan`. .. literalinclude:: src/basiclayout/tutorial/__init__.py :lines: 21 @@ -208,12 +214,12 @@ Let's try to understand the components in this module: The ``context`` argument signifies that the decorated view callable ``my_view`` should only be run when :term:`traversal` finds the ``tutorial.models.MyModel`` :term:`resource` as the :term:`context` of a request. In English this means that when the URL ``/`` is visited, and because ``MyModel`` is the root model, this view callable will be invoked. - The ``renderer`` argument names an :term:`asset specification` of ``templates/mytemplate.pt``. + The ``renderer`` argument names an :term:`asset specification` of ``tutorial:templates/mytemplate.pt``. This asset specification points at a :term:`Chameleon` template which lives in the ``mytemplate.pt`` file within the ``templates`` directory of the ``tutorial`` package. And indeed if you look in the ``templates`` directory of this package, you will see a ``mytemplate.pt`` template file This template renders the default home page of the generated project. - This asset specification is *relative* to the ``views`` package. - Alternatively we could have used the absolute asset specification ``tutorial:templates/mytemplate.pt``. + This asset specification is *absolute* to the ``views`` package. + Alternatively we could have used the relative asset specification ``../templates/mytemplate.pt``. Since this call to ``@view_config`` doesn't pass a ``name`` argument, the ``my_view`` function which it decorates represents the "default" view callable used when the context is of the type ``MyModel``. @@ -225,7 +231,7 @@ Let's try to understand the components in this module: The function returns the dictionary ``{'project': 'myproj'}``. This dictionary is used by the template named by the ``mytemplate.pt`` asset specification to fill in certain values on the page. -Let us open ``tutorial/views/default.py`` in the ``views`` package to look at the second view. +Let us open ``tutorial/views/notfound.py`` in the ``views`` package to look at the second view. .. literalinclude:: src/basiclayout/tutorial/views/notfound.py :linenos: @@ -237,7 +243,7 @@ Without repeating ourselves, we will point out the differences between this view The ``notfound_view`` function is decorated with ``@notfound_view_config``. This decorator registers a :term:`Not Found View` using :meth:`pyramid.config.Configurator.add_notfound_view`. - The ``renderer`` argument names an :term:`asset specification` of ``templates/404.pt``. + The ``renderer`` argument names an :term:`asset specification` of ``tutorial:templates/404.pt``. #. *Lines 5-7*. A :term:`view callable` named ``notfound_view`` is defined, which is decorated in the step above. diff --git a/docs/tutorials/wiki/definingviews.rst b/docs/tutorials/wiki/definingviews.rst index bd8dc6ecf..2e4d009a1 100644 --- a/docs/tutorials/wiki/definingviews.rst +++ b/docs/tutorials/wiki/definingviews.rst @@ -73,7 +73,7 @@ Success executing this command will end with a line to the console similar to th .. code-block:: text - Successfully installed docutils-0.14 tutorial + Successfully installed docutils-0.15.2 tutorial Adding view functions in the ``views`` package @@ -356,7 +356,7 @@ Our templates name static assets, including CSS and images. We don't need to create these files within our package's ``static`` directory because they were provided by the cookiecutter at the time we created the project. As an example, the CSS file will be accessed via ``http://localhost:6543/static/theme.css`` by virtue of the call to the ``add_static_view`` directive in the ``routes.py`` file. -Any number and type of static assets can be placed in this directory (or subdirectories) +Any number and type of static assets can be placed in this directory (or subdirectories). They are referred to by either URL or using the convenience method ``static_url``, for example ``request.static_url('<package>:static/foo.css')``, within templates. diff --git a/docs/tutorials/wiki/installation.rst b/docs/tutorials/wiki/installation.rst index cfa021540..6088f577d 100644 --- a/docs/tutorials/wiki/installation.rst +++ b/docs/tutorials/wiki/installation.rst @@ -185,18 +185,20 @@ The console will show ``pip`` checking for packages and installing missing packa .. code-block:: bash - Successfully installed BTrees-4.5.1 Chameleon-3.5 Mako-1.0.7 \ - MarkupSafe-1.1.0 PasteDeploy-1.5.2 Pygments-2.2.0 WebTest-2.0.32 \ - ZConfig-3.3.0 ZEO-5.2.0 ZODB-5.5.1 ZODB3-3.11.0 atomicwrites-1.2.1 \ - attrs-18.2.0 beautifulsoup4-4.6.3 coverage-4.5.2 hupper-1.4.1 \ - more-itertools-4.3.0 persistent-4.4.3 plaster-1.0 plaster-pastedeploy-0.6 \ - pluggy-0.8.0 py-1.7.0 pyramid-1.10.1 pyramid-chameleon-0.3 \ - pyramid-debugtoolbar-4.5 pyramid-mako-1.0.2 pyramid-retry-1.0 \ - pyramid-tm-2.2.1 pyramid-zodbconn-0.8.1 pytest-4.0.0 pytest-cov-2.6.0 \ - repoze.lru-0.7 six-1.11.0 transaction-2.4.0 translationstring-1.3 \ - tutorial venusian-1.1.0 waitress-1.1.0 webob-1.8.4 zc.lockfile-1.4 \ - zdaemon-4.3 zodbpickle-1.0.2 zodburi-2.3.0 zope.deprecation-4.3.0 \ - zope.interface-4.6.0 + Successfully installed BTrees-4.6.1 Chameleon-3.6.2 Mako-1.1.0 \ + MarkupSafe-1.1.1 PasteDeploy-2.0.1 Pygments-2.5.2 WebTest-2.0.33 \ + ZConfig-3.5.0 ZEO-5.2.1 ZODB-5.5.1 ZODB3-3.11.0 attrs-19.3.0 \ + beautifulsoup4-4.8.2 cffi-1.13.2 coverage-5.0.1 hupper-1.9.1 \ + importlib-metadata-1.3.0 more-itertools-8.0.2 packaging-19.2 \ + persistent-4.5.1 plaster-1.0 plaster-pastedeploy-0.7 pluggy-0.13.1 \ + py-1.8.1 pycparser-2.19 pyparsing-2.4.6 pyramid-1.10.4 \ + pyramid-chameleon-0.3 pyramid-debugtoolbar-4.5.1 pyramid-mako-1.1.0 \ + pyramid-retry-2.1 pyramid-tm-2.3 pyramid-zodbconn-0.8.1 pytest-5.3.2 \ + pytest-cov-2.8.1 repoze.lru-0.7 six-1.13.0 soupsieve-1.9.5 \ + transaction-3.0.0 translationstring-1.3 tutorial venusian-3.0.0 \ + waitress-1.4.1 wcwidth-0.1.7 webob-1.8.5 zc.lockfile-2.0 zdaemon-4.3 \ + zipp-0.6.0 zodbpickle-2.0.0 zodburi-2.4.0 zope.deprecation-4.4.0 \ + zope.interface-4.7.1 Testing requirements are defined in our project's ``setup.py`` file, in the ``tests_require`` and ``extras_require`` stanzas. @@ -241,8 +243,8 @@ For a successful test run, you should see output that ends like this: .. code-block:: bash - . - 1 passed in 0.24 seconds + .. + 2 passed in 0.49 seconds Expose test coverage information @@ -274,29 +276,28 @@ If successful, you will see output something like this: .. code-block:: bash ======================== test session starts ========================= - platform darwin -- Python 3.7.0, pytest-4.0.0, py-1.7.0, pluggy-0.8.0 - rootdir: /Users/stevepiercy/projects/hack-on-pyramid/tutorial, inifile: pytest.ini - plugins: cov-2.6.0 - collected 1 item + platform darwin -- Python 3.7.3, pytest-5.3.2, py-1.8.1, pluggy-0.13.1 + rootdir: /filepath/tutorial, inifile: pytest.ini, testpaths: tutorial + plugins: cov-2.8.1 + collected 2 items + + tutorial/tests.py .. [100%] - tutorial/tests.py . - [100%] ---------- coverage: platform darwin, python 3.7.0-final-0 ----------- Name Stmts Miss Cover Missing ----------------------------------------------------------- - tutorial/__init__.py 17 12 29% 7-8, 14-23 + tutorial/__init__.py 16 11 31% 7-8, 14-22 tutorial/models/__init__.py 8 4 50% 9-12 tutorial/pshell.py 6 6 0% 1-12 tutorial/routes.py 2 2 0% 1-2 tutorial/views/__init__.py 0 0 100% tutorial/views/default.py 4 0 100% - tutorial/views/notfound.py 4 4 0% 1-7 + tutorial/views/notfound.py 4 0 100% ----------------------------------------------------------- - TOTAL 41 28 32% - + TOTAL 40 23 42% - ===================== 1 passed in 0.31 seconds ======================= + ===================== 2 passed in 0.55 seconds ======================= Our package doesn't quite have 100% test coverage. @@ -316,14 +317,14 @@ On Unix .. code-block:: bash - $VENV/bin/pytest --cov=tutorial tutorial/tests.py -q + $VENV/bin/pytest --cov=tutorial tests.py -q On Windows ^^^^^^^^^^ .. code-block:: doscon - %VENV%\Scripts\pytest --cov=tutorial tutorial\tests.py -q + %VENV%\Scripts\pytest --cov=tutorial tests -q ``pytest`` follows :ref:`conventions for Python test discovery <pytest:test discovery>`. @@ -365,8 +366,8 @@ If successful, you will see something like this on your console: .. code-block:: text - Starting subprocess with file monitor - Starting server in PID 44078. + Starting monitor for PID 65233. + Starting server in PID 65233. Serving on http://localhost:6543 Serving on http://localhost:6543 diff --git a/docs/tutorials/wiki/src/authorization/.coveragerc b/docs/tutorials/wiki/src/authorization/.coveragerc index a1d87d03d..5db0e79cf 100644 --- a/docs/tutorials/wiki/src/authorization/.coveragerc +++ b/docs/tutorials/wiki/src/authorization/.coveragerc @@ -1,3 +1,2 @@ [run] source = tutorial -omit = tutorial/test* diff --git a/docs/tutorials/wiki/src/authorization/MANIFEST.in b/docs/tutorials/wiki/src/authorization/MANIFEST.in index 05cc195d9..b4624fd1c 100644 --- a/docs/tutorials/wiki/src/authorization/MANIFEST.in +++ b/docs/tutorials/wiki/src/authorization/MANIFEST.in @@ -1,2 +1,5 @@ include *.txt *.ini *.cfg *.rst recursive-include tutorial *.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/tutorials/wiki/src/authorization/pytest.ini b/docs/tutorials/wiki/src/authorization/pytest.ini index a3489cdf8..42c3259f9 100644 --- a/docs/tutorials/wiki/src/authorization/pytest.ini +++ b/docs/tutorials/wiki/src/authorization/pytest.ini @@ -1,3 +1,6 @@ [pytest] -testpaths = tutorial -python_files = test*.py +addopts = --strict + +testpaths = + tutorial + tests diff --git a/docs/tutorials/wiki/src/authorization/setup.py b/docs/tutorials/wiki/src/authorization/setup.py index fa5948acb..f19d643e6 100644 --- a/docs/tutorials/wiki/src/authorization/setup.py +++ b/docs/tutorials/wiki/src/authorization/setup.py @@ -44,7 +44,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/tutorials/wiki/src/authorization/tests/__init__.py b/docs/tutorials/wiki/src/authorization/tests/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/docs/tutorials/wiki/src/authorization/tests/__init__.py diff --git a/docs/tutorials/wiki/src/authorization/tutorial/tests.py b/docs/tutorials/wiki/src/authorization/tests/test_it.py index 6279d9f66..6c72bcc62 100644 --- a/docs/tutorials/wiki/src/authorization/tutorial/tests.py +++ b/docs/tutorials/wiki/src/authorization/tests/test_it.py @@ -11,8 +11,14 @@ class ViewTests(unittest.TestCase): testing.tearDown() def test_my_view(self): - from .views.default import my_view + from tutorial.views.default import my_view request = testing.DummyRequest() info = my_view(request) self.assertEqual(info['project'], 'myproj') + def test_notfound_view(self): + from tutorial.views.notfound import notfound_view + request = testing.DummyRequest() + info = notfound_view(request) + self.assertEqual(info, {}) + diff --git a/docs/tutorials/wiki/src/authorization/tutorial/templates/layout.pt b/docs/tutorials/wiki/src/authorization/tutorial/templates/layout.pt index b606e8dad..06a3c8157 100644 --- a/docs/tutorials/wiki/src/authorization/tutorial/templates/layout.pt +++ b/docs/tutorials/wiki/src/authorization/tutorial/templates/layout.pt @@ -1,5 +1,5 @@ <!DOCTYPE html metal:define-macro="layout"> -<html lang="{{request.locale_name}}"> +<html lang="${request.locale_name}"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> diff --git a/docs/tutorials/wiki/src/authorization/tutorial/views/default.py b/docs/tutorials/wiki/src/authorization/tutorial/views/default.py index 3a3b170e2..7ba99c65b 100644 --- a/docs/tutorials/wiki/src/authorization/tutorial/views/default.py +++ b/docs/tutorials/wiki/src/authorization/tutorial/views/default.py @@ -24,7 +24,7 @@ def view_wiki(context, request): return HTTPFound(location=request.resource_url(context, 'FrontPage')) -@view_config(context='..models.Page', renderer='../templates/view.pt', +@view_config(context='..models.Page', renderer='tutorial:templates/view.pt', permission='view') def view_page(context, request): wiki = context.__parent__ @@ -47,7 +47,7 @@ def view_page(context, request): @view_config(name='add_page', context='..models.Wiki', - renderer='../templates/edit.pt', + renderer='tutorial:templates/edit.pt', permission='edit') def add_page(context, request): pagename = request.subpath[0] @@ -67,7 +67,7 @@ def add_page(context, request): @view_config(name='edit_page', context='..models.Page', - renderer='../templates/edit.pt', + renderer='tutorial:templates/edit.pt', permission='edit') def edit_page(context, request): if 'form.submitted' in request.params: @@ -80,8 +80,8 @@ def edit_page(context, request): @view_config(context='..models.Wiki', name='login', - renderer='../templates/login.pt') -@forbidden_view_config(renderer='../templates/login.pt') + renderer='tutorial:templates/login.pt') +@forbidden_view_config(renderer='tutorial:templates/login.pt') def login(request): login_url = request.resource_url(request.context, 'login') referrer = request.url diff --git a/docs/tutorials/wiki/src/authorization/tutorial/views/notfound.py b/docs/tutorials/wiki/src/authorization/tutorial/views/notfound.py index d44b4d0e6..dd0b00488 100644 --- a/docs/tutorials/wiki/src/authorization/tutorial/views/notfound.py +++ b/docs/tutorials/wiki/src/authorization/tutorial/views/notfound.py @@ -3,7 +3,7 @@ from pyramid.view import notfound_view_config from ..models import Page -@notfound_view_config(renderer='../templates/404.pt') +@notfound_view_config(renderer='tutorial:templates/404.pt') def notfound_view(request): request.response.status = 404 pagename = request.path diff --git a/docs/tutorials/wiki/src/basiclayout/.coveragerc b/docs/tutorials/wiki/src/basiclayout/.coveragerc index a1d87d03d..5db0e79cf 100644 --- a/docs/tutorials/wiki/src/basiclayout/.coveragerc +++ b/docs/tutorials/wiki/src/basiclayout/.coveragerc @@ -1,3 +1,2 @@ [run] source = tutorial -omit = tutorial/test* diff --git a/docs/tutorials/wiki/src/basiclayout/MANIFEST.in b/docs/tutorials/wiki/src/basiclayout/MANIFEST.in index 05cc195d9..b4624fd1c 100644 --- a/docs/tutorials/wiki/src/basiclayout/MANIFEST.in +++ b/docs/tutorials/wiki/src/basiclayout/MANIFEST.in @@ -1,2 +1,5 @@ include *.txt *.ini *.cfg *.rst recursive-include tutorial *.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/tutorials/wiki/src/basiclayout/pytest.ini b/docs/tutorials/wiki/src/basiclayout/pytest.ini index a3489cdf8..42c3259f9 100644 --- a/docs/tutorials/wiki/src/basiclayout/pytest.ini +++ b/docs/tutorials/wiki/src/basiclayout/pytest.ini @@ -1,3 +1,6 @@ [pytest] -testpaths = tutorial -python_files = test*.py +addopts = --strict + +testpaths = + tutorial + tests diff --git a/docs/tutorials/wiki/src/basiclayout/setup.py b/docs/tutorials/wiki/src/basiclayout/setup.py index d6d488ed2..f85780010 100644 --- a/docs/tutorials/wiki/src/basiclayout/setup.py +++ b/docs/tutorials/wiki/src/basiclayout/setup.py @@ -42,7 +42,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/tutorials/wiki/src/basiclayout/tests/__init__.py b/docs/tutorials/wiki/src/basiclayout/tests/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/docs/tutorials/wiki/src/basiclayout/tests/__init__.py diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/tests.py b/docs/tutorials/wiki/src/basiclayout/tests/test_it.py index 6279d9f66..6c72bcc62 100644 --- a/docs/tutorials/wiki/src/basiclayout/tutorial/tests.py +++ b/docs/tutorials/wiki/src/basiclayout/tests/test_it.py @@ -11,8 +11,14 @@ class ViewTests(unittest.TestCase): testing.tearDown() def test_my_view(self): - from .views.default import my_view + from tutorial.views.default import my_view request = testing.DummyRequest() info = my_view(request) self.assertEqual(info['project'], 'myproj') + def test_notfound_view(self): + from tutorial.views.notfound import notfound_view + request = testing.DummyRequest() + info = notfound_view(request) + self.assertEqual(info, {}) + diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/templates/layout.pt b/docs/tutorials/wiki/src/basiclayout/tutorial/templates/layout.pt index 9fdaef00f..9ca01382b 100644 --- a/docs/tutorials/wiki/src/basiclayout/tutorial/templates/layout.pt +++ b/docs/tutorials/wiki/src/basiclayout/tutorial/templates/layout.pt @@ -1,5 +1,5 @@ <!DOCTYPE html metal:define-macro="layout"> -<html lang="{{request.locale_name}}"> +<html lang="${request.locale_name}"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/views/default.py b/docs/tutorials/wiki/src/basiclayout/tutorial/views/default.py index 5d708d15c..51ec5ed98 100644 --- a/docs/tutorials/wiki/src/basiclayout/tutorial/views/default.py +++ b/docs/tutorials/wiki/src/basiclayout/tutorial/views/default.py @@ -3,6 +3,6 @@ from pyramid.view import view_config from ..models import MyModel -@view_config(context=MyModel, renderer='../templates/mytemplate.pt') +@view_config(context=MyModel, renderer='tutorial:templates/mytemplate.pt') def my_view(request): return {'project': 'myproj'} diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/views/notfound.py b/docs/tutorials/wiki/src/basiclayout/tutorial/views/notfound.py index 728791d0a..59a37280e 100644 --- a/docs/tutorials/wiki/src/basiclayout/tutorial/views/notfound.py +++ b/docs/tutorials/wiki/src/basiclayout/tutorial/views/notfound.py @@ -1,7 +1,7 @@ from pyramid.view import notfound_view_config -@notfound_view_config(renderer='../templates/404.pt') +@notfound_view_config(renderer='tutorial:templates/404.pt') def notfound_view(request): request.response.status = 404 return {} diff --git a/docs/tutorials/wiki/src/installation/.coveragerc b/docs/tutorials/wiki/src/installation/.coveragerc index a1d87d03d..5db0e79cf 100644 --- a/docs/tutorials/wiki/src/installation/.coveragerc +++ b/docs/tutorials/wiki/src/installation/.coveragerc @@ -1,3 +1,2 @@ [run] source = tutorial -omit = tutorial/test* diff --git a/docs/tutorials/wiki/src/installation/MANIFEST.in b/docs/tutorials/wiki/src/installation/MANIFEST.in index 05cc195d9..b4624fd1c 100644 --- a/docs/tutorials/wiki/src/installation/MANIFEST.in +++ b/docs/tutorials/wiki/src/installation/MANIFEST.in @@ -1,2 +1,5 @@ include *.txt *.ini *.cfg *.rst recursive-include tutorial *.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/tutorials/wiki/src/installation/pytest.ini b/docs/tutorials/wiki/src/installation/pytest.ini index a3489cdf8..42c3259f9 100644 --- a/docs/tutorials/wiki/src/installation/pytest.ini +++ b/docs/tutorials/wiki/src/installation/pytest.ini @@ -1,3 +1,6 @@ [pytest] -testpaths = tutorial -python_files = test*.py +addopts = --strict + +testpaths = + tutorial + tests diff --git a/docs/tutorials/wiki/src/installation/setup.py b/docs/tutorials/wiki/src/installation/setup.py index d6d488ed2..f85780010 100644 --- a/docs/tutorials/wiki/src/installation/setup.py +++ b/docs/tutorials/wiki/src/installation/setup.py @@ -42,7 +42,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/tutorials/wiki/src/installation/tests/__init__.py b/docs/tutorials/wiki/src/installation/tests/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/docs/tutorials/wiki/src/installation/tests/__init__.py diff --git a/docs/tutorials/wiki/src/installation/tutorial/tests.py b/docs/tutorials/wiki/src/installation/tests/test_it.py index 6279d9f66..6c72bcc62 100644 --- a/docs/tutorials/wiki/src/installation/tutorial/tests.py +++ b/docs/tutorials/wiki/src/installation/tests/test_it.py @@ -11,8 +11,14 @@ class ViewTests(unittest.TestCase): testing.tearDown() def test_my_view(self): - from .views.default import my_view + from tutorial.views.default import my_view request = testing.DummyRequest() info = my_view(request) self.assertEqual(info['project'], 'myproj') + def test_notfound_view(self): + from tutorial.views.notfound import notfound_view + request = testing.DummyRequest() + info = notfound_view(request) + self.assertEqual(info, {}) + diff --git a/docs/tutorials/wiki/src/installation/tutorial/templates/layout.pt b/docs/tutorials/wiki/src/installation/tutorial/templates/layout.pt index 9fdaef00f..9ca01382b 100644 --- a/docs/tutorials/wiki/src/installation/tutorial/templates/layout.pt +++ b/docs/tutorials/wiki/src/installation/tutorial/templates/layout.pt @@ -1,5 +1,5 @@ <!DOCTYPE html metal:define-macro="layout"> -<html lang="{{request.locale_name}}"> +<html lang="${request.locale_name}"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> diff --git a/docs/tutorials/wiki/src/installation/tutorial/views/default.py b/docs/tutorials/wiki/src/installation/tutorial/views/default.py index 5d708d15c..51ec5ed98 100644 --- a/docs/tutorials/wiki/src/installation/tutorial/views/default.py +++ b/docs/tutorials/wiki/src/installation/tutorial/views/default.py @@ -3,6 +3,6 @@ from pyramid.view import view_config from ..models import MyModel -@view_config(context=MyModel, renderer='../templates/mytemplate.pt') +@view_config(context=MyModel, renderer='tutorial:templates/mytemplate.pt') def my_view(request): return {'project': 'myproj'} diff --git a/docs/tutorials/wiki/src/installation/tutorial/views/notfound.py b/docs/tutorials/wiki/src/installation/tutorial/views/notfound.py index 728791d0a..59a37280e 100644 --- a/docs/tutorials/wiki/src/installation/tutorial/views/notfound.py +++ b/docs/tutorials/wiki/src/installation/tutorial/views/notfound.py @@ -1,7 +1,7 @@ from pyramid.view import notfound_view_config -@notfound_view_config(renderer='../templates/404.pt') +@notfound_view_config(renderer='tutorial:templates/404.pt') def notfound_view(request): request.response.status = 404 return {} diff --git a/docs/tutorials/wiki/src/models/.coveragerc b/docs/tutorials/wiki/src/models/.coveragerc index a1d87d03d..5db0e79cf 100644 --- a/docs/tutorials/wiki/src/models/.coveragerc +++ b/docs/tutorials/wiki/src/models/.coveragerc @@ -1,3 +1,2 @@ [run] source = tutorial -omit = tutorial/test* diff --git a/docs/tutorials/wiki/src/models/MANIFEST.in b/docs/tutorials/wiki/src/models/MANIFEST.in index 05cc195d9..b4624fd1c 100644 --- a/docs/tutorials/wiki/src/models/MANIFEST.in +++ b/docs/tutorials/wiki/src/models/MANIFEST.in @@ -1,2 +1,5 @@ include *.txt *.ini *.cfg *.rst recursive-include tutorial *.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/tutorials/wiki/src/models/pytest.ini b/docs/tutorials/wiki/src/models/pytest.ini index a3489cdf8..42c3259f9 100644 --- a/docs/tutorials/wiki/src/models/pytest.ini +++ b/docs/tutorials/wiki/src/models/pytest.ini @@ -1,3 +1,6 @@ [pytest] -testpaths = tutorial -python_files = test*.py +addopts = --strict + +testpaths = + tutorial + tests diff --git a/docs/tutorials/wiki/src/models/setup.py b/docs/tutorials/wiki/src/models/setup.py index d6d488ed2..f85780010 100644 --- a/docs/tutorials/wiki/src/models/setup.py +++ b/docs/tutorials/wiki/src/models/setup.py @@ -42,7 +42,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/tutorials/wiki/src/models/tests/__init__.py b/docs/tutorials/wiki/src/models/tests/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/docs/tutorials/wiki/src/models/tests/__init__.py diff --git a/docs/tutorials/wiki/src/models/tutorial/tests.py b/docs/tutorials/wiki/src/models/tests/test_it.py index 6279d9f66..6c72bcc62 100644 --- a/docs/tutorials/wiki/src/models/tutorial/tests.py +++ b/docs/tutorials/wiki/src/models/tests/test_it.py @@ -11,8 +11,14 @@ class ViewTests(unittest.TestCase): testing.tearDown() def test_my_view(self): - from .views.default import my_view + from tutorial.views.default import my_view request = testing.DummyRequest() info = my_view(request) self.assertEqual(info['project'], 'myproj') + def test_notfound_view(self): + from tutorial.views.notfound import notfound_view + request = testing.DummyRequest() + info = notfound_view(request) + self.assertEqual(info, {}) + diff --git a/docs/tutorials/wiki/src/models/tutorial/templates/layout.pt b/docs/tutorials/wiki/src/models/tutorial/templates/layout.pt index 9fdaef00f..9ca01382b 100644 --- a/docs/tutorials/wiki/src/models/tutorial/templates/layout.pt +++ b/docs/tutorials/wiki/src/models/tutorial/templates/layout.pt @@ -1,5 +1,5 @@ <!DOCTYPE html metal:define-macro="layout"> -<html lang="{{request.locale_name}}"> +<html lang="${request.locale_name}"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> diff --git a/docs/tutorials/wiki/src/models/tutorial/views/default.py b/docs/tutorials/wiki/src/models/tutorial/views/default.py index 5d708d15c..51ec5ed98 100644 --- a/docs/tutorials/wiki/src/models/tutorial/views/default.py +++ b/docs/tutorials/wiki/src/models/tutorial/views/default.py @@ -3,6 +3,6 @@ from pyramid.view import view_config from ..models import MyModel -@view_config(context=MyModel, renderer='../templates/mytemplate.pt') +@view_config(context=MyModel, renderer='tutorial:templates/mytemplate.pt') def my_view(request): return {'project': 'myproj'} diff --git a/docs/tutorials/wiki/src/models/tutorial/views/notfound.py b/docs/tutorials/wiki/src/models/tutorial/views/notfound.py index 728791d0a..59a37280e 100644 --- a/docs/tutorials/wiki/src/models/tutorial/views/notfound.py +++ b/docs/tutorials/wiki/src/models/tutorial/views/notfound.py @@ -1,7 +1,7 @@ from pyramid.view import notfound_view_config -@notfound_view_config(renderer='../templates/404.pt') +@notfound_view_config(renderer='tutorial:templates/404.pt') def notfound_view(request): request.response.status = 404 return {} diff --git a/docs/tutorials/wiki/src/tests/.coveragerc b/docs/tutorials/wiki/src/tests/.coveragerc index a1d87d03d..5db0e79cf 100644 --- a/docs/tutorials/wiki/src/tests/.coveragerc +++ b/docs/tutorials/wiki/src/tests/.coveragerc @@ -1,3 +1,2 @@ [run] source = tutorial -omit = tutorial/test* diff --git a/docs/tutorials/wiki/src/tests/MANIFEST.in b/docs/tutorials/wiki/src/tests/MANIFEST.in index 05cc195d9..b4624fd1c 100644 --- a/docs/tutorials/wiki/src/tests/MANIFEST.in +++ b/docs/tutorials/wiki/src/tests/MANIFEST.in @@ -1,2 +1,5 @@ include *.txt *.ini *.cfg *.rst recursive-include tutorial *.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/tutorials/wiki/src/tests/pytest.ini b/docs/tutorials/wiki/src/tests/pytest.ini index a3489cdf8..42c3259f9 100644 --- a/docs/tutorials/wiki/src/tests/pytest.ini +++ b/docs/tutorials/wiki/src/tests/pytest.ini @@ -1,3 +1,6 @@ [pytest] -testpaths = tutorial -python_files = test*.py +addopts = --strict + +testpaths = + tutorial + tests diff --git a/docs/tutorials/wiki/src/tests/setup.py b/docs/tutorials/wiki/src/tests/setup.py index fa5948acb..f19d643e6 100644 --- a/docs/tutorials/wiki/src/tests/setup.py +++ b/docs/tutorials/wiki/src/tests/setup.py @@ -44,7 +44,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/tutorials/wiki/src/tests/tests/__init__.py b/docs/tutorials/wiki/src/tests/tests/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/docs/tutorials/wiki/src/tests/tests/__init__.py diff --git a/docs/tutorials/wiki/src/tests/tutorial/tests.py b/docs/tutorials/wiki/src/tests/tests/test_it.py index ff1c07b7c..e45380e6f 100644 --- a/docs/tutorials/wiki/src/tests/tutorial/tests.py +++ b/docs/tutorials/wiki/src/tests/tests/test_it.py @@ -5,7 +5,7 @@ from pyramid import testing class PageModelTests(unittest.TestCase): def _getTargetClass(self): - from .models import Page + from tutorial.models import Page return Page def _makeOne(self, data='some data'): @@ -18,7 +18,7 @@ class PageModelTests(unittest.TestCase): class WikiModelTests(unittest.TestCase): def _getTargetClass(self): - from .models import Wiki + from tutorial.models import Wiki return Wiki def _makeOne(self): @@ -32,7 +32,7 @@ class WikiModelTests(unittest.TestCase): class AppmakerTests(unittest.TestCase): def _callFUT(self, zodb_root): - from .models import appmaker + from tutorial.models import appmaker return appmaker(zodb_root) def test_it(self): @@ -43,7 +43,7 @@ class AppmakerTests(unittest.TestCase): class ViewWikiTests(unittest.TestCase): def test_it(self): - from .views.default import view_wiki + from tutorial.views.default import view_wiki context = testing.DummyResource() request = testing.DummyRequest() response = view_wiki(context, request) @@ -51,7 +51,7 @@ class ViewWikiTests(unittest.TestCase): class ViewPageTests(unittest.TestCase): def _callFUT(self, context, request): - from .views.default import view_page + from tutorial.views.default import view_page return view_page(context, request) def test_it(self): @@ -77,7 +77,7 @@ class ViewPageTests(unittest.TestCase): class AddPageTests(unittest.TestCase): def _callFUT(self, context, request): - from .views.default import add_page + from tutorial.views.default import add_page return add_page(context, request) def test_it_notsubmitted(self): @@ -103,7 +103,7 @@ class AddPageTests(unittest.TestCase): class EditPageTests(unittest.TestCase): def _callFUT(self, context, request): - from .views.default import edit_page + from tutorial.views.default import edit_page return edit_page(context, request) def test_it_notsubmitted(self): @@ -124,7 +124,7 @@ class EditPageTests(unittest.TestCase): class SecurityTests(unittest.TestCase): def test_hashing(self): - from .security import hash_password, check_password + from tutorial.security import hash_password, check_password password = 'secretpassword' hashed_password = hash_password(password) self.assertTrue(check_password(hashed_password, password)) @@ -145,7 +145,7 @@ class FunctionalTests(unittest.TestCase): def setUp(self): import tempfile import os.path - from . import main + from tutorial import main self.tmpdir = tempfile.mkdtemp() dbpath = os.path.join( self.tmpdir, 'test.db') diff --git a/docs/tutorials/wiki/src/tests/tutorial/templates/layout.pt b/docs/tutorials/wiki/src/tests/tutorial/templates/layout.pt index b606e8dad..06a3c8157 100644 --- a/docs/tutorials/wiki/src/tests/tutorial/templates/layout.pt +++ b/docs/tutorials/wiki/src/tests/tutorial/templates/layout.pt @@ -1,5 +1,5 @@ <!DOCTYPE html metal:define-macro="layout"> -<html lang="{{request.locale_name}}"> +<html lang="${request.locale_name}"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> diff --git a/docs/tutorials/wiki/src/tests/tutorial/views/default.py b/docs/tutorials/wiki/src/tests/tutorial/views/default.py index 3a3b170e2..7ba99c65b 100644 --- a/docs/tutorials/wiki/src/tests/tutorial/views/default.py +++ b/docs/tutorials/wiki/src/tests/tutorial/views/default.py @@ -24,7 +24,7 @@ def view_wiki(context, request): return HTTPFound(location=request.resource_url(context, 'FrontPage')) -@view_config(context='..models.Page', renderer='../templates/view.pt', +@view_config(context='..models.Page', renderer='tutorial:templates/view.pt', permission='view') def view_page(context, request): wiki = context.__parent__ @@ -47,7 +47,7 @@ def view_page(context, request): @view_config(name='add_page', context='..models.Wiki', - renderer='../templates/edit.pt', + renderer='tutorial:templates/edit.pt', permission='edit') def add_page(context, request): pagename = request.subpath[0] @@ -67,7 +67,7 @@ def add_page(context, request): @view_config(name='edit_page', context='..models.Page', - renderer='../templates/edit.pt', + renderer='tutorial:templates/edit.pt', permission='edit') def edit_page(context, request): if 'form.submitted' in request.params: @@ -80,8 +80,8 @@ def edit_page(context, request): @view_config(context='..models.Wiki', name='login', - renderer='../templates/login.pt') -@forbidden_view_config(renderer='../templates/login.pt') + renderer='tutorial:templates/login.pt') +@forbidden_view_config(renderer='tutorial:templates/login.pt') def login(request): login_url = request.resource_url(request.context, 'login') referrer = request.url diff --git a/docs/tutorials/wiki/src/tests/tutorial/views/notfound.py b/docs/tutorials/wiki/src/tests/tutorial/views/notfound.py index d44b4d0e6..dd0b00488 100644 --- a/docs/tutorials/wiki/src/tests/tutorial/views/notfound.py +++ b/docs/tutorials/wiki/src/tests/tutorial/views/notfound.py @@ -3,7 +3,7 @@ from pyramid.view import notfound_view_config from ..models import Page -@notfound_view_config(renderer='../templates/404.pt') +@notfound_view_config(renderer='tutorial:templates/404.pt') def notfound_view(request): request.response.status = 404 pagename = request.path diff --git a/docs/tutorials/wiki/src/views/.coveragerc b/docs/tutorials/wiki/src/views/.coveragerc index a1d87d03d..5db0e79cf 100644 --- a/docs/tutorials/wiki/src/views/.coveragerc +++ b/docs/tutorials/wiki/src/views/.coveragerc @@ -1,3 +1,2 @@ [run] source = tutorial -omit = tutorial/test* diff --git a/docs/tutorials/wiki/src/views/MANIFEST.in b/docs/tutorials/wiki/src/views/MANIFEST.in index 05cc195d9..b4624fd1c 100644 --- a/docs/tutorials/wiki/src/views/MANIFEST.in +++ b/docs/tutorials/wiki/src/views/MANIFEST.in @@ -1,2 +1,5 @@ include *.txt *.ini *.cfg *.rst recursive-include tutorial *.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/tutorials/wiki/src/views/pytest.ini b/docs/tutorials/wiki/src/views/pytest.ini index a3489cdf8..42c3259f9 100644 --- a/docs/tutorials/wiki/src/views/pytest.ini +++ b/docs/tutorials/wiki/src/views/pytest.ini @@ -1,3 +1,6 @@ [pytest] -testpaths = tutorial -python_files = test*.py +addopts = --strict + +testpaths = + tutorial + tests diff --git a/docs/tutorials/wiki/src/views/setup.py b/docs/tutorials/wiki/src/views/setup.py index 6f3cae397..439bb7759 100644 --- a/docs/tutorials/wiki/src/views/setup.py +++ b/docs/tutorials/wiki/src/views/setup.py @@ -43,7 +43,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/tutorials/wiki/src/views/tests/__init__.py b/docs/tutorials/wiki/src/views/tests/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/docs/tutorials/wiki/src/views/tests/__init__.py diff --git a/docs/tutorials/wiki/src/views/tests/test_it.py b/docs/tutorials/wiki/src/views/tests/test_it.py new file mode 100644 index 000000000..6c72bcc62 --- /dev/null +++ b/docs/tutorials/wiki/src/views/tests/test_it.py @@ -0,0 +1,24 @@ +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 tutorial.views.default import my_view + request = testing.DummyRequest() + info = my_view(request) + self.assertEqual(info['project'], 'myproj') + + def test_notfound_view(self): + from tutorial.views.notfound import notfound_view + request = testing.DummyRequest() + info = notfound_view(request) + self.assertEqual(info, {}) + diff --git a/docs/tutorials/wiki/src/views/tutorial/templates/layout.pt b/docs/tutorials/wiki/src/views/tutorial/templates/layout.pt index b606e8dad..06a3c8157 100644 --- a/docs/tutorials/wiki/src/views/tutorial/templates/layout.pt +++ b/docs/tutorials/wiki/src/views/tutorial/templates/layout.pt @@ -1,5 +1,5 @@ <!DOCTYPE html metal:define-macro="layout"> -<html lang="{{request.locale_name}}"> +<html lang="${request.locale_name}"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> diff --git a/docs/tutorials/wiki/src/views/tutorial/tests.py b/docs/tutorials/wiki/src/views/tutorial/tests.py deleted file mode 100644 index 6279d9f66..000000000 --- a/docs/tutorials/wiki/src/views/tutorial/tests.py +++ /dev/null @@ -1,18 +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'], 'myproj') - diff --git a/docs/tutorials/wiki/src/views/tutorial/views/default.py b/docs/tutorials/wiki/src/views/tutorial/views/default.py index b4b65a49b..e7921cf2f 100644 --- a/docs/tutorials/wiki/src/views/tutorial/views/default.py +++ b/docs/tutorials/wiki/src/views/tutorial/views/default.py @@ -15,7 +15,7 @@ def view_wiki(context, request): return HTTPFound(location=request.resource_url(context, 'FrontPage')) -@view_config(context='..models.Page', renderer='../templates/view.pt') +@view_config(context='..models.Page', renderer='tutorial:templates/view.pt') def view_page(context, request): wiki = context.__parent__ @@ -36,7 +36,7 @@ def view_page(context, request): @view_config(name='add_page', context='..models.Wiki', - renderer='../templates/edit.pt') + renderer='tutorial:templates/edit.pt') def add_page(context, request): pagename = request.subpath[0] if 'form.submitted' in request.params: @@ -54,7 +54,7 @@ def add_page(context, request): @view_config(name='edit_page', context='..models.Page', - renderer='../templates/edit.pt') + renderer='tutorial:templates/edit.pt') def edit_page(context, request): if 'form.submitted' in request.params: context.data = request.params['body'] diff --git a/docs/tutorials/wiki/src/views/tutorial/views/notfound.py b/docs/tutorials/wiki/src/views/tutorial/views/notfound.py index d44b4d0e6..dd0b00488 100644 --- a/docs/tutorials/wiki/src/views/tutorial/views/notfound.py +++ b/docs/tutorials/wiki/src/views/tutorial/views/notfound.py @@ -3,7 +3,7 @@ from pyramid.view import notfound_view_config from ..models import Page -@notfound_view_config(renderer='../templates/404.pt') +@notfound_view_config(renderer='tutorial:templates/404.pt') def notfound_view(request): request.response.status = 404 pagename = request.path diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index 9dacc5f96..f710b3b10 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -4,7 +4,7 @@ Adding Tests ============ -We will now add tests for the models and the views and a few functional tests in ``tests.py``. +We will now add tests for the models and the views and a few functional tests in ``tests/test_it.py``. Tests ensure that an application works, and that it continues to work when changes are made in the future. @@ -12,10 +12,9 @@ Test the models =============== We write tests for the ``model`` classes and the ``appmaker``. -Changing ``tests.py``, we will write a separate test class for each ``model`` class +We will modify our ``test_it.py`` file, writing a separate test class for each ``model`` class. We will also write a test class for the ``appmaker``. -To do so, we will retain the ``tutorial.tests.ViewTests`` class that was generated from choosing the ``zodb`` backend option. We will add three test classes, one for each of the following: - the ``Page`` model named ``PageModelTests`` @@ -26,7 +25,7 @@ We will add three test classes, one for each of the following: Test the views ============== -We will modify our ``tests.py`` file, adding tests for each view function that we added previously. +We will modify our ``test_it.py`` file, adding tests for each view function that we added previously. As a result, we will delete the ``ViewTests`` class that the ``zodb`` backend option provided, and add four other test classes: ``ViewWikiTests``, ``ViewPageTests``, ``AddPageTests``, and ``EditPageTests``. These test the ``view_wiki``, ``view_page``, ``add_page``, and ``edit_page`` views. @@ -35,14 +34,15 @@ Functional tests ================ We will test the whole application, covering security aspects that are not tested in the unit tests, such as logging in, logging out, checking that the ``viewer`` user cannot add or edit pages, but the ``editor`` user can, and so on. +As a result we will add two test classes, ``SecurityTests`` and ``FunctionalTests``. -View the results of all our edits to ``tests.py`` -================================================= +View the results of all our edits to ``tests/test_it.py`` +========================================================= -Open the ``tutorial/tests.py`` module, and edit it such that it appears as follows: +Open the ``tests/test_it.py`` module, and edit it such that it appears as follows: -.. literalinclude:: src/tests/tutorial/tests.py +.. literalinclude:: src/tests/tests/test_it.py :linenos: :language: python |
