summaryrefslogtreecommitdiff
path: root/docs/narr
diff options
context:
space:
mode:
authorSteve Piercy <web@stevepiercy.com>2020-01-01 18:27:30 -0800
committerSteve Piercy <web@stevepiercy.com>2020-01-02 23:30:59 -0800
commitdece4d25b136a493dfeeeb516487d4d756bc69e9 (patch)
tree86ad34f28e774667b28109c82f4dd8d0a4249e7b /docs/narr
parent3157775a08ff9e48b0fff8057f4482d78d266f01 (diff)
downloadpyramid-dece4d25b136a493dfeeeb516487d4d756bc69e9.tar.gz
pyramid-dece4d25b136a493dfeeeb516487d4d756bc69e9.tar.bz2
pyramid-dece4d25b136a493dfeeeb516487d4d756bc69e9.zip
Resync through project.rst after moving tests directory
Diffstat (limited to 'docs/narr')
-rw-r--r--docs/narr/myproject/MANIFEST.in3
-rw-r--r--docs/narr/myproject/pytest.ini7
-rw-r--r--docs/narr/myproject/tests/__init__.py0
-rw-r--r--docs/narr/myproject/tests/test_it.py (renamed from docs/narr/myproject/myproject/tests.py)4
-rw-r--r--docs/narr/project.rst61
5 files changed, 42 insertions, 33 deletions
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/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
--- /dev/null
+++ b/docs/narr/myproject/tests/__init__.py
diff --git a/docs/narr/myproject/myproject/tests.py b/docs/narr/myproject/tests/test_it.py
index 48f0095ad..b300da34d 100644
--- a/docs/narr/myproject/myproject/tests.py
+++ b/docs/narr/myproject/tests/test_it.py
@@ -11,13 +11,13 @@ class ViewTests(unittest.TestCase):
testing.tearDown()
def test_my_view(self):
- from .views.default import my_view
+ 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 .views.notfound import notfound_view
+ from myproject.views.notfound import notfound_view
request = testing.DummyRequest()
info = notfound_view(request)
self.assertEqual(info, {})
diff --git a/docs/narr/project.rst b/docs/narr/project.rst
index e0f0be1f3..fc5cfd056 100644
--- a/docs/narr/project.rst
+++ b/docs/narr/project.rst
@@ -266,7 +266,8 @@ Here's sample output from a test run on Unix:
....
4 passed in 0.45 seconds
-The tests themselves are found in the ``tests.py`` module in your ``cookiecutter``-generated project. Within this project generated by the ``pyramid-cookiecutter-starter`` cookiecutter, only a few sample tests exist.
+The tests themselves are found in the ``test_it.py`` module in the ``tests`` package in your ``cookiecutter``-generated project.
+Within this project generated by the ``pyramid-cookiecutter-starter`` cookiecutter, only a few sample tests exist.
.. note::
@@ -288,7 +289,7 @@ path to the module on which we want to run tests and coverage.
.. code-block:: bash
- $VENV/bin/pytest --cov=myproject myproject/tests.py -q
+ $VENV/bin/pytest --cov=myproject myproject tests -q
.. seealso:: See ``pytest``'s documentation for :ref:`pytest:usage` or invoke
``pytest -h`` to see its full set of options.
@@ -535,6 +536,8 @@ The ``myproject`` project we've generated has the following directory structure:
├── .gitignore
├── CHANGES.txt
├── MANIFEST.in
+ ├── README.txt
+ ├── development.ini
├── myproject
│   ├── __init__.py
│   ├── routes.py
@@ -546,16 +549,37 @@ The ``myproject`` project we've generated has the following directory structure:
│   │   ├── 404.jinja2
│   │   ├── layout.jinja2
│   │   └── mytemplate.jinja2
- │   ├── tests.py
│   └── views
│   ├── __init__.py
│   ├── default.py
│   └── notfound.py
- ├── README.txt
- ├── development.ini
├── production.ini
├── pytest.ini
- └── setup.py
+ ├── setup.py
+ └── tests
+ ├── __init__.py
+ └── test_it.py
+
+
+.. index::
+ single: tests
+
+``test_it.py``
+~~~~~~~~~~~~~~
+
+The ``test_it.py`` module in the ``tests`` package includes tests for your application.
+
+.. literalinclude:: myproject/tests/test_it.py
+ :language: python
+ :linenos:
+
+This sample ``test_it.py`` file has two unit tests and two functional tests defined within it.
+These tests are executed when you run ``pytest -q``.
+You may add more tests here as you build your application.
+You are not required to write tests to use :app:`Pyramid`.
+This file is simply provided for convenience and example.
+
+See :ref:`testing_chapter` for more information about writing :app:`Pyramid` unit tests.
The ``myproject`` :term:`Project`
@@ -591,6 +615,8 @@ describe, run, and test your application.
#. ``setup.py`` is the file you'll use to test and distribute your application.
It is a standard :term:`Setuptools` ``setup.py`` file.
+#. ``tests`` package which contains unit and functional test code for the application.
+
.. index::
single: PasteDeploy
single: ini file
@@ -819,8 +845,6 @@ The ``myproject`` :term:`package` lives inside the ``myproject``
#. A ``templates`` directory, which contains :term:`Jinja2` (or other types
of) templates.
-#. A ``tests.py`` module, which contains unit and functional test code for the application.
-
#. A ``routes.py`` module, which contains routing code for the application.
#. A ``views`` package, which contains view code for the application.
@@ -1041,27 +1065,6 @@ It inherits the HTML provided by ``layout.jinja2``, replacing the content block
.. index::
- single: tests.py
-
-``tests.py``
-~~~~~~~~~~~~
-
-The ``tests.py`` module includes tests for your application.
-
-.. literalinclude:: myproject/myproject/tests.py
- :language: python
- :linenos:
-
-This sample ``tests.py`` file has two unit tests and two functional tests defined
-within it. These tests are executed when you run ``pytest -q``. You may add
-more tests here as you build your application. You are not required to write
-tests to use :app:`Pyramid`. This file is simply provided for convenience and
-example.
-
-See :ref:`testing_chapter` for more information about writing :app:`Pyramid`
-unit tests.
-
-.. index::
pair: modifying; package structure
.. _modifying_package_structure: