public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] pytest: Shorten traceback length by default
@ 2021-10-06  2:18 Simon Glass
  2021-10-15 11:51 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Glass @ 2021-10-06  2:18 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Marek Vasut, Simon Glass, Heinrich Schuchardt,
	Stephen Warren

This produces a lot of code output which is not very helpful and is quite
annoying to wade through. Use the short format by default.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 doc/develop/py_testing.rst | 7 +++++++
 test/py/test.py            | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/doc/develop/py_testing.rst b/doc/develop/py_testing.rst
index 4f1e1f66e76..52238ca54d3 100644
--- a/doc/develop/py_testing.rst
+++ b/doc/develop/py_testing.rst
@@ -103,6 +103,13 @@ will be written to `${build_dir}/test-log.html`. This is best viewed in a web
 browser, but may be read directly as plain text, perhaps with the aid of the
 `html2text` utility.
 
+Controlling output
+~~~~~~~~~~~~~~~~~~
+
+By default a short backtrace is reported. If you would like a longer one,
+pass ``--tb=long`` when running the test. See the pytest documentation for
+more options.
+
 Running tests in parallel
 ~~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/test/py/test.py b/test/py/test.py
index 285fda54258..95859a66e29 100755
--- a/test/py/test.py
+++ b/test/py/test.py
@@ -17,4 +17,9 @@ if __name__ == '__main__':
     # argv; py.test test_directory_name user-supplied-arguments
     args = [os.path.dirname(__file__) + '/tests']
     args.extend(sys.argv)
+
+    # Use short format by default
+    if not [arg for arg in args if '--tb=' in arg]:
+        args.append('--tb=short')
+
     sys.exit(pytest.main(args))
-- 
2.33.0.800.g4c38ced690-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-15 11:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-06  2:18 [PATCH] pytest: Shorten traceback length by default Simon Glass
2021-10-15 11:51 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox