From 68ba583735aedc6762131af2cf93cf0fdd470fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20F=C3=A9rotin?= Date: Fri, 6 May 2016 19:45:32 +0200 Subject: doc: Update documentation for using ``py.test [--cov]`` for newly created project with scaffolds. --- docs/narr/project.rst | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/narr/project.rst b/docs/narr/project.rst index 56247ee33..8849e9ee7 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -209,25 +209,29 @@ 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 The tests themselves are found in the ``tests.py`` module in your ``pcreate`` generated project. Within a project generated by the ``starter`` scaffold, -only two sample tests exist. +only two sample tests exist. Previous command is identical to: + +.. code-block:: bash + + $ $VENV/bin/py.test myproject/tests.py -q .. note:: @@ -235,6 +239,14 @@ 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 -q --cov + + .. index:: single: running an application single: pserve -- cgit v1.2.3 From e09369f02f61f2443f393bcd29fa84e970268b53 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 7 May 2016 00:54:55 -0700 Subject: wordsmith py.test and coverage configuration --- docs/narr/project.rst | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/narr/project.rst b/docs/narr/project.rst index 8849e9ee7..a25394151 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -227,11 +227,7 @@ Here's sample output from a test run on UNIX: The tests themselves are found in the ``tests.py`` module in your ``pcreate`` generated project. Within a project generated by the ``starter`` scaffold, -only two sample tests exist. Previous command is identical to: - -.. code-block:: bash - - $ $VENV/bin/py.test myproject/tests.py -q +only two sample tests exist. .. note:: @@ -244,7 +240,19 @@ to ``py.test``: .. code-block:: bash - $ $VENV/bin/py.test -q --cov + $ $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:: -- cgit v1.2.3