diff options
author | Gilad Beeri <giladb.dev@gmail.com> | 2018-06-14 13:31:14 +0300 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2018-06-23 00:35:31 +0200 |
commit | aaf100148e7a1250c9ec393739e42823429070e6 (patch) | |
tree | c53edd683fab5a85bfb4dff264e45157c8c574fd /gnuradio-runtime/python/gnuradio/gr_unittest.py | |
parent | 5eaa059e568a9017383c341e4a38361900158e31 (diff) |
tests: added option to pass verbosity parameter (and fixed some styling)
Diffstat (limited to 'gnuradio-runtime/python/gnuradio/gr_unittest.py')
-rwxr-xr-x | gnuradio-runtime/python/gnuradio/gr_unittest.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gnuradio-runtime/python/gnuradio/gr_unittest.py b/gnuradio-runtime/python/gnuradio/gr_unittest.py index b20fa076de..49d1189635 100755 --- a/gnuradio-runtime/python/gnuradio/gr_unittest.py +++ b/gnuradio-runtime/python/gnuradio/gr_unittest.py @@ -27,6 +27,7 @@ import unittest import gr_xmlrunner import sys, os, stat + class TestCase(unittest.TestCase): """A subclass of unittest.TestCase that adds additional assertions @@ -110,7 +111,8 @@ TextTestRunner = unittest.TextTestRunner TestProgram = unittest.TestProgram main = TestProgram -def run(PUT, filename=None): + +def run(PUT, filename=None, verbosity=1): ''' Runs the unittest on a TestCase and produces an optional XML report PUT: the program under test and should be a gr_unittest.TestCase @@ -138,10 +140,10 @@ def run(PUT, filename=None): st = os.stat(path)[stat.ST_MODE] if(st & stat.S_IWUSR > 0): # Create an XML runner to filename - fout = file(path+"/"+filename, "w") + fout = file(path + "/" + filename, "w") xmlrunner = gr_xmlrunner.XMLTestRunner(fout) - txtrunner = TextTestRunner(verbosity=1) + txtrunner = TextTestRunner(verbosity=verbosity) # Run the test; runner also creates XML output file # FIXME: make xmlrunner output to screen so we don't have to do run and main @@ -151,7 +153,7 @@ def run(PUT, filename=None): if(xmlrunner is not None): xmlrunner.run(suite) - main() + main(verbosity=verbosity) # This will run and fail make check if problem # but does not output to screen. @@ -159,7 +161,7 @@ def run(PUT, filename=None): else: # If no filename is given, just run the test - main() + main(verbosity=verbosity) ############################################################################## |