summaryrefslogtreecommitdiff
path: root/docs/narr/testing.rst
diff options
context:
space:
mode:
authorMichael Merickel <mmerickel@users.noreply.github.com>2016-04-12 17:56:53 -0500
committerMichael Merickel <mmerickel@users.noreply.github.com>2016-04-12 17:56:53 -0500
commit73cd1e62745fddee602e95837f155ffd499e51b7 (patch)
tree462e7bec14ef3f5531837f9ab7d1bfd2a3f4d797 /docs/narr/testing.rst
parentfa43952e617ad68c52447da28fc7f5be23ff4b10 (diff)
parent39d7c8bb68a94cf29256ba5da463da0432b0233c (diff)
downloadpyramid-73cd1e62745fddee602e95837f155ffd499e51b7.tar.gz
pyramid-73cd1e62745fddee602e95837f155ffd499e51b7.tar.bz2
pyramid-73cd1e62745fddee602e95837f155ffd499e51b7.zip
Merge pull request #2468 from Pylons/docs/easy-install-to-pip.2104
Docs: easy install to pip
Diffstat (limited to 'docs/narr/testing.rst')
-rw-r--r--docs/narr/testing.rst47
1 files changed, 19 insertions, 28 deletions
diff --git a/docs/narr/testing.rst b/docs/narr/testing.rst
index a3f62058b..354a462d4 100644
--- a/docs/narr/testing.rst
+++ b/docs/narr/testing.rst
@@ -275,7 +275,7 @@ without needing to invoke the actual application configuration implied by its
In the above example, we create a ``MyTest`` test case that inherits from
:class:`unittest.TestCase`. If it's in our :app:`Pyramid` application, it will
-be found when ``setup.py test`` is run. It has two test methods.
+be found when ``py.test`` is run. It has two test methods.
The first test method, ``test_view_fn_forbidden`` tests the ``view_fn`` when
the authentication policy forbids the current user the ``edit`` permission. Its
@@ -365,46 +365,37 @@ Functional tests test your literal application.
In Pyramid, functional tests are typically written using the :term:`WebTest`
package, which provides APIs for invoking HTTP(S) requests to your application.
+We also like ``py.test`` and ``pytest-cov`` to provide simple testing and
+coverage reports.
-Regardless of which testing :term:`package` you use, ensure to add a
-``tests_require`` dependency on that package to your application's
-``setup.py`` file. Using the project ``MyProject`` generated by the starter
-scaffold as described in :doc:`project`, we would insert the following code immediately following the
-``requires`` block in the file ``MyProject/setup.py``.
+Regardless of which testing :term:`package` you use, be sure to add a
+``tests_require`` dependency on that package to your application's ``setup.py``
+file. Using the project ``MyProject`` generated by the starter scaffold as
+described in :doc:`project`, we would insert the following code immediately
+following the ``requires`` block in the file ``MyProject/setup.py``.
-.. code-block:: ini
+.. literalinclude:: MyProject/setup.py
+ :language: python
:linenos:
+ :lines: 11-22
:lineno-start: 11
:emphasize-lines: 8-
- requires = [
- 'pyramid',
- 'pyramid_chameleon',
- 'pyramid_debugtoolbar',
- 'waitress',
- ]
-
- test_requires = [
- 'webtest',
- ]
-
Remember to change the dependency.
-.. code-block:: ini
+.. literalinclude:: MyProject/setup.py
+ :language: python
:linenos:
- :lineno-start: 39
- :emphasize-lines: 2
-
- install_requires=requires,
- tests_require=test_requires,
- test_suite="myproject",
+ :lines: 40-44
+ :lineno-start: 40
+ :emphasize-lines: 2-4
-As always, whenever you change your dependencies, make sure to run the
-following command.
+As always, whenever you change your dependencies, make sure to run the correct
+``pip install -e`` command.
.. code-block:: bash
- $VENV/bin/python setup.py develop
+ $VENV/bin/pip install -e ".[testing]"
In your ``MyPackage`` project, your :term:`package` is named ``myproject``
which contains a ``views`` module, which in turn contains a :term:`view`