summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/quick_tutorial/functional_testing.rst43
-rw-r--r--docs/quick_tutorial/functional_testing/setup.py9
2 files changed, 34 insertions, 18 deletions
diff --git a/docs/quick_tutorial/functional_testing.rst b/docs/quick_tutorial/functional_testing.rst
index 7c4dcee26..d3ada3793 100644
--- a/docs/quick_tutorial/functional_testing.rst
+++ b/docs/quick_tutorial/functional_testing.rst
@@ -31,31 +31,40 @@ Objectives
Steps
=====
-#. First we copy the results of the previous step, as well as install the
- ``webtest`` package:
+#. First we copy the results of the previous step.
- .. code-block:: bash
+ .. code-block:: bash
- cd ..; cp -r unit_testing functional_testing; cd functional_testing
- $VENV/bin/pip install -e .
- $VENV/bin/pip install webtest
+ cd ..; cp -r unit_testing functional_testing; cd functional_testing
-#. Let's extend ``functional_testing/tutorial/tests.py`` to include a
- functional test:
+#. Add ``webtest`` to our project's dependencies in ``setup.py`` as a :term:`Setuptools` "extra":
- .. literalinclude:: functional_testing/tutorial/tests.py
- :linenos:
+ .. literalinclude:: functional_testing/setup.py
+ :language: python
+ :linenos:
+ :emphasize-lines: 14
- Be sure this file is not executable, or ``pytest`` may not include your
- tests.
+#. Install our project and its newly added dependency.
+ Note that we use the extra specifier ``[test]`` to install testing requirements.
+
+ .. code-block:: bash
+
+ $VENV/bin/pip install -e .[test]
+
+#. Let's extend ``functional_testing/tutorial/tests.py`` to include a functional test:
+
+ .. literalinclude:: functional_testing/tutorial/tests.py
+ :linenos:
+
+ Be sure this file is not executable, or ``pytest`` may not include your tests.
-#. Now run the tests:
+#. Now run the tests:
- .. code-block:: bash
+ .. code-block:: bash
- $VENV/bin/pytest tutorial/tests.py -q
- ..
- 2 passed in 0.25 seconds
+ $VENV/bin/pytest tutorial/tests.py -q
+ ..
+ 2 passed in 0.25 seconds
Analysis
diff --git a/docs/quick_tutorial/functional_testing/setup.py b/docs/quick_tutorial/functional_testing/setup.py
index a93cf6a73..c0d3dee8f 100644
--- a/docs/quick_tutorial/functional_testing/setup.py
+++ b/docs/quick_tutorial/functional_testing/setup.py
@@ -2,13 +2,20 @@ from setuptools import setup
requires = [
'pyramid',
+ 'pyramid_debugtoolbar',
'waitress',
]
setup(name='tutorial',
install_requires=requires,
+ extras_require={
+ 'test': [
+ 'pytest',
+ 'webtest',
+ ],
+ },
entry_points="""\
[paste.app_factory]
main = tutorial:main
""",
-) \ No newline at end of file
+ )