eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit fd43a3938f6d2a3c53f4146226a88461865dd0f5
parent 42fe6c5a1565d40df76c6f330397f2e0029275c9
Author: James Prestwood <prestwoj@gmail.com>
Date:   Tue, 17 Aug 2021 09:44:57 -0700

test-runner: extend -S option

The -S/--sub-tests option allows the user to specify a test file
from inside an autotest. Inside this file there may also be many
test functions. This option is being extended to allow running
a single test function inside a test file. For example:

* Runs all test functions inside connection_test.py *
./test-runner -A some_test -S connection_test

* Runs only connection_test.py test_connect_success() *
./test-runner -A some_test -S connection_test.test_connect_success

Diffstat:
Mtools/test-runner | 33++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/tools/test-runner b/tools/test-runner @@ -1139,6 +1139,13 @@ def start_test(ctx, subtests, rqueue): # Iterating through each python test file for test in subtest: + limit_funcs = [] + + if ctx.args.sub_tests: + for i in ctx.args.sub_tests: + if len(i.split('.')) == 2: + limit_funcs.append(i.split('.')[1]) + # Iterating through individual test functions inside a # Test() class. Due to the nature of unittest we have # to jump through some hoops to set up the test class @@ -1164,21 +1171,29 @@ def start_test(ctx, subtests, rqueue): result = TestResult() try: + skip = len(limit_funcs) > 0 and func not in limit_funcs + # Set up class only on first test if index == 0: - dbg("%s\n\t%s RUNNING" % (file, str(func)), end='') + if not skip: + dbg("%s\n\t%s RUNNING" % (file, str(func)), end='') t.setUpClass() else: - dbg("\t%s RUNNING" % str(func), end='') + if not skip: + dbg("\t%s RUNNING" % str(func), end='') sys.__stdout__.flush() - # Run test (setUp/tearDown run automatically) - result = t() + if not skip: + # Run test (setUp/tearDown run automatically) + result = t() # Tear down class only on last test if index == len(tlist) - 1: t.tearDownClass() + + if skip: + continue except unittest.SkipTest as e: result.skipped.append(t) except Exception as e: @@ -1256,9 +1271,13 @@ def pre_test(ctx, test, copied): pruned = [] for s in subtests: - # Allow test name both with and without the extension - if s in ctx.args.sub_tests or os.path.splitext(s)[0] in ctx.args.sub_tests: - pruned.append(s) + file = s + # Handle <file>.<test function> format + if '.' in s: + file = s.split('.')[0] + '.py' + + if file == s: + pruned.append(file) subtests = pruned