Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaffolds: allow pytest run without args #2545

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions docs/narr/project.rst
Original file line number Diff line number Diff line change
Expand Up @@ -209,32 +209,44 @@ 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::

The ``-q`` option is passed to the ``py.test`` command to limit the output
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
Expand Down
3 changes: 3 additions & 0 deletions pyramid/scaffolds/alchemy/+dot+coveragerc_tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[run]
source = {{package}}
omit = {{package}}/test*
3 changes: 3 additions & 0 deletions pyramid/scaffolds/alchemy/pytest.ini_tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
testpaths = {{package}}
python_files = *.py
3 changes: 3 additions & 0 deletions pyramid/scaffolds/starter/+dot+coveragerc_tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[run]
source = {{package}}
omit = {{package}}/test*
3 changes: 3 additions & 0 deletions pyramid/scaffolds/starter/pytest.ini_tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
testpaths = {{package}}
python_files = *.py
3 changes: 3 additions & 0 deletions pyramid/scaffolds/zodb/+dot+coveragerc_tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[run]
source = {{package}}
omit = {{package}}/test*
3 changes: 3 additions & 0 deletions pyramid/scaffolds/zodb/pytest.ini_tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
testpaths = {{package}}
python_files = *.py