summaryrefslogtreecommitdiff
path: root/docs/devguide
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-02-11 18:08:07 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2018-02-12 00:25:28 +0100
commit5a25c98cb6d387791e41c7dc240c55814988519a (patch)
tree9b92cbf881cc8458a0532ce686fe6c8f8e7c4970 /docs/devguide
parent21cee6cc4fbc7fb1a28a15840924b0da52b49fca (diff)
downloadpygobject-5a25c98cb6d387791e41c7dc240c55814988519a.tar.gz
tests: Make it possible to use pytest directlywip/creiter/pytest-direct
pytest will just import the files passed to it and try to run tests. Since we need to run some setup code convert the tests directory to a Python package and do the initialization in __init__.py. This makes the init code (env vars, typelib search path, dbus) always run when something from the package gets imported. python3 setup.py build_tests # build pygobject and tests py.test-3 tests/test_gi.py # run tests in test_gi.py only
Diffstat (limited to 'docs/devguide')
-rw-r--r--docs/devguide/building_testing.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/devguide/building_testing.rst b/docs/devguide/building_testing.rst
index 79c73f52..f2c9624e 100644
--- a/docs/devguide/building_testing.rst
+++ b/docs/devguide/building_testing.rst
@@ -53,6 +53,9 @@ Using Setuptools
# 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
@@ -64,5 +67,8 @@ Using Setuptools
TEST_NAMES=test_gi.TestUtf8 python3 setup.py test
TEST_NAMES=test_gi.TestUtf8.test_utf8_full_return python3 setup.py test
+ # using pytest directly
+ py.test-3 tests/test_gi.py
+
# Running flake8 tests
python3 setup.py quality