summaryrefslogtreecommitdiff
path: root/docs/narr
diff options
context:
space:
mode:
authorSteve Piercy <web@stevepiercy.com>2016-05-08 12:07:08 -0700
committerSteve Piercy <web@stevepiercy.com>2016-05-08 12:07:08 -0700
commitc28854062b2092a416fb48a671b07248c47df6b5 (patch)
tree585208aa81b4e1fbae994965ec3a3eb11b364c8e /docs/narr
parentd785b7d7e3608848cdb9d21e7b43b524f4251ff3 (diff)
parentd0c1f9ad5e82c265974f5c678c9d4ea459375593 (diff)
downloadpyramid-c28854062b2092a416fb48a671b07248c47df6b5.tar.gz
pyramid-c28854062b2092a416fb48a671b07248c47df6b5.tar.bz2
pyramid-c28854062b2092a416fb48a671b07248c47df6b5.zip
Merge pull request #2550 from Pylons/vincent-ferotin-scaffolds-allow-pytest-run-without-args
Vincent ferotin scaffolds allow pytest run without args
Diffstat (limited to 'docs/narr')
-rw-r--r--docs/narr/project.rst34
1 files changed, 27 insertions, 7 deletions
diff --git a/docs/narr/project.rst b/docs/narr/project.rst
index 56247ee33..1ce12a938 100644
--- a/docs/narr/project.rst
+++ b/docs/narr/project.rst
@@ -209,19 +209,19 @@ On UNIX:
.. code-block:: bash
- $ $VENV/bin/py.test myproject/tests.py -q
+ $ $VENV/bin/py.test -q
On Windows:
.. code-block:: doscon
- > %VENV%\Scripts\py.test myproject\tests.py -q
+ > %VENV%\Scripts\py.test -q
Here's sample output from a test run on UNIX:
.. code-block:: bash
- $ $VENV/bin/py.test myproject/tests.py -q
+ $ $VENV/bin/py.test -q
..
2 passed in 0.47 seconds
@@ -235,6 +235,26 @@ only two sample tests exist.
to a stream of dots. If you don't pass ``-q``, you'll see verbose test
result output (which normally isn't very useful).
+Alternatively, if you'd like to see test coverage, pass the ``--cov`` option
+to ``py.test``:
+
+.. code-block:: bash
+
+ $ $VENV/bin/py.test --cov -q
+
+Scaffolds include configuration defaults for ``py.test`` and test coverage.
+These configuration files are ``pytest.ini`` and ``.coveragerc``, located at
+the root of your package. Without these defaults, we would need to specify the
+path to the module on which we want to run tests and coverage.
+
+.. code-block:: bash
+
+ $ $VENV/bin/py.test --cov=myproject myproject/tests.py -q
+
+.. seealso:: See py.test's documentation for :ref:`pytest:usage` or invoke
+ ``py.test -h`` to see its full set of options.
+
+
.. index::
single: running an application
single: pserve
@@ -909,10 +929,10 @@ The ``tests.py`` module includes unit tests for your application.
:linenos:
This sample ``tests.py`` file has one unit test and one functional test defined
-within it. These tests are executed when you run ``py.test myproject/tests.py
--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.
+within it. These tests are executed when you run ``py.test -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.