summaryrefslogtreecommitdiff
path: root/docs/devguide/building_testing.rst
blob: 4f4c0758b846868ecd45fd9824389103f0fc343c (plain)
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
==================
Building & Testing
==================

To pass extra arguments to pytest you can set "PYTEST_ADDOPTS":

.. code:: shell

    # don't hide stdout
    export PYTEST_ADDOPTS="-s"
    python3 setup.py test


Using Setuptools
----------------

.. code:: shell

    # Build in-tree
    python3 setup.py build_ext --inplace

    # Build in-tree including tests
    python3 setup.py build_tests

    # Executing some code after the build
    PYTHONPATH=. python3 foo.py

    # Running tests
    python3 setup.py test

    # To test only a specific file/class/function::
    TEST_NAMES=test_gi python3 python3 setup.py test
    TEST_NAMES=test_gi.TestUtf8 python3 setup.py test
    TEST_NAMES=test_gi.TestUtf8.test_utf8_full_return python3 setup.py test

    # To display stdout and pytest verbose output:
    PYGI_TEST_VERBOSE=yes python3 setup.py test
    # or:
    python3 setup.py test -s

    # using pytest directly
    py.test-3 tests/test_gi.py

    # Running flake8 tests
    python3 setup.py quality

    # Run under gdb
    python3 setup.py test --gdb

    # Run under valgrind
    python3 setup.py test --valgrind --valgrind-log-file=valgrind.log

    # Create a release tarball for GNOME
    python3 setup.py sdist_gnome