Skip to content

Commit

Permalink
docs: Replace py.test with pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyans800755 committed May 8, 2017
1 parent b1a0cdc commit 8678fd1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
12 changes: 6 additions & 6 deletions docs/Developers/Executing_Tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ You can then execute our tests with

::

$ py.test
$ pytest

.. note::
If ``py.test`` seems to give errors, try running ``python3 -m pytest``
If ``pytest`` seems to give errors, try running ``python3 -m pytest``
instead.

and report any errors you get!
Expand All @@ -48,11 +48,11 @@ To run our tests, you can also use ``python3 setup.py test``

If you need to customize test running, you can get more options
about allowing skipped tests, getting code coverage displayed
or omitting/selecting tests using ``py.test`` directly.
or omitting/selecting tests using ``pytest`` directly.

::

$ py.test --help
$ pytest --help

.. note::

Expand All @@ -66,12 +66,12 @@ To get coverage information, you can run:

::

$ py.test --cov
$ pytest --cov

You can view the coverage report as html by running:

::

$ py.test --cov --cov-report html
$ pytest --cov --cov-report html

The html report will be saved ``.htmlreport`` inside the coala repository.
13 changes: 6 additions & 7 deletions docs/Developers/Writing_Tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,27 @@ automatically executed by running:

::

$ py.test
$ pytest

There's only one constraint:
The name of the test file has to end with ``Test.py`` (for example
``MyCustomTest.py``, but not ``MyCustomTestSuite.py``).

.. note::
If ``py.test`` seems to give errors, try running ``python3 -m pytest``
If ``pytest`` seems to give errors, try running ``python3 -m pytest``
instead.

.. note::

Often you don't want to run all available tests. To run your
specific one, type (in the coala root folder):

.. code:: shell
$ py.test -k <your-test>
$ pytest -k <your-test>
You can even give partial names or queries like "not MyCustomTest"
to not run a specific test. More information can be got with
``py.test -h``
``pytest -h``

Coming to the test file structure. Every test script starts with your
imports. According to the coala code style (and pep8 style) we first do
Expand Down Expand Up @@ -129,7 +128,7 @@ So an example test that succeeds would be:


The branch coverage can be measured locally with the
``py.test --cov`` command.
``pytest --cov`` command.

.. seealso::

Expand Down Expand Up @@ -187,7 +186,7 @@ as a kickstart for test-writing.

Put the code under the desired folder inside ``tests``,
modify it to let it test your stuff and run the test from
the coala root folder ``py.test``.
the coala root folder ``pytest``.

.. code:: python
Expand Down

0 comments on commit 8678fd1

Please sign in to comment.