[pygobject: 1/2] tests: expose a verbosity environment variable
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject: 1/2] tests: expose a verbosity environment variable
- Date: Tue, 13 Mar 2018 19:28:57 +0000 (UTC)
commit cf997f974127efbd6aa8e5faa86b09d4b5d285bd
Author: Mathieu Duponchelle <mathieu centricular com>
Date: Tue Mar 13 19:20:13 2018 +0100
tests: expose a verbosity environment variable
docs/devguide/building_testing.rst | 6 ++++++
tests/runtests.py | 9 +++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/docs/devguide/building_testing.rst b/docs/devguide/building_testing.rst
index f2c9624e..963bb85b 100644
--- a/docs/devguide/building_testing.rst
+++ b/docs/devguide/building_testing.rst
@@ -35,6 +35,9 @@ Using Autotools
make check TEST_NAMES=test_gi.TestUtf8
make check TEST_NAMES=test_gi.TestUtf8.test_utf8_full_return
+ # To display stdout and pytest verbose output:
+ PYGI_TEST_VERBOSE=yes make check
+
# To execute all the tests in a gdb session
make check.gdb
@@ -67,6 +70,9 @@ Using Setuptools
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
+
# using pytest directly
py.test-3 tests/test_gi.py
diff --git a/tests/runtests.py b/tests/runtests.py
index 652dc99f..7a56f789 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -16,6 +16,11 @@ def main(argv):
mydir = os.path.dirname(os.path.abspath(__file__))
+ verbosity_args = []
+
+ if 'PYGI_TEST_VERBOSE' in os.environ:
+ verbosity_args += ['-v', '--capture=no']
+
if 'TEST_NAMES' in os.environ:
names = os.environ['TEST_NAMES'].split()
elif 'TEST_FILES' in os.environ:
@@ -27,14 +32,14 @@ def main(argv):
for filename in argv[1:]:
names.append(filename.replace('.py', ''))
else:
- return pytest.main([mydir])
+ return pytest.main([mydir] + verbosity_args)
def unittest_to_pytest_name(name):
parts = name.split(".")
parts[0] = os.path.join(mydir, parts[0] + ".py")
return "::".join(parts)
- return pytest.main([unittest_to_pytest_name(n) for n in names])
+ return pytest.main([unittest_to_pytest_name(n) for n in names] + verbosity_args)
if __name__ == "__main__":
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]