File: testing.rst

package info (click to toggle)
quodlibet 4.6.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 18,016 kB
  • sloc: python: 85,817; sh: 385; xml: 110; makefile: 91
file content (54 lines) | stat: -rw-r--r-- 1,486 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
.. _Testing:

=======
Testing
=======

Quod Libet uses the CPython unittest framework for testing and `pytest
<https://docs.pytest.org/en/latest/>`__ as a test runner. All testing related
code can be found under ``quodlibet/tests``.

To run the full tests suite simply execute::

    ./setup.py test

For checking the code coverage of the test suite run::

    ./setup.py coverage


Selecting a Specific Test
-------------------------

To only test a subset of the test suite, pass a comma separated list of test
class names to setup.py via the ``--to-run`` option. For example::

    ./setup.py test --to-run=TMP3File,TAPICType

Similarly the coverage report can also be generated for a subset of tests::

    ./setup.py coverage --to-run=TMP3File,TAPICType

Selecting by class name can take a long time because it needs to import all
tests first. To speed things up you can just use pytest directly::

    py.test tests/test_formats_mp3.py
    py.test tests/test_formats*
    py.test tests/test_formats_mp3.py::TMP3File

To just run code quality tests::

    py.test tests/quality

Some helpful ``py.test`` options are ``-s`` for not hiding stdout and ``-x``
for stopping on the first error. For more information check out
https://docs.pytest.org/en/latest/usage.html


Abort on First Error
--------------------

By passing ``-x`` to ``setup.py test`` the test suite will abort once it
sees the first error instead of printing a summary of errors at the end::

    ./setup.py test -x