aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/run_tests.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/test/run_tests.py b/test/run_tests.py
index f5d0d3546a2..6ceb0af958e 100644
--- a/test/run_tests.py
+++ b/test/run_tests.py
@@ -83,7 +83,7 @@ class TestResult(dict):
tc_id = testcase.id()
if tc_id not in self[PASS] and tc_id not in self[SKIP]:
rerun_ids.add(tc_id)
- if len(rerun_ids) > 0:
+ if rerun_ids:
return suite_from_failed(self.testcase_suite, rerun_ids)
def get_testcase_names(self, test_id):
@@ -218,11 +218,11 @@ class TestCaseWrapper(object):
def stdouterr_reader_wrapper(unread_testcases, finished_unread_testcases,
read_testcases):
read_testcase = None
- while read_testcases.is_set() or len(unread_testcases):
- if len(finished_unread_testcases):
+ while read_testcases.is_set() or unread_testcases:
+ if finished_unread_testcases:
read_testcase = finished_unread_testcases.pop()
unread_testcases.remove(read_testcase)
- elif len(unread_testcases):
+ elif unread_testcases:
read_testcase = unread_testcases.pop()
if read_testcase:
data = ''
@@ -293,7 +293,7 @@ def handle_cores(failed_testcases):
if debug_core:
for failed_testcase in failed_testcases:
tcs_with_core = failed_testcase.testclasess_with_core
- if len(tcs_with_core) > 0:
+ if tcs_with_core:
for test, vpp_binary, tempdir in tcs_with_core.values():
check_and_handle_core(vpp_binary, tempdir, test)
@@ -327,7 +327,7 @@ def run_forked(testcase_suites):
manager = StreamQueueManager()
manager.start()
for i in range(concurrent_tests):
- if len(testcase_suites) > 0:
+ if testcase_suites:
wrapped_testcase_suite = TestCaseWrapper(testcase_suites.pop(0),
manager)
wrapped_testcase_suites.add(wrapped_testcase_suite)
@@ -347,7 +347,7 @@ def run_forked(testcase_suites):
stop_run = False
try:
- while len(wrapped_testcase_suites) > 0:
+ while wrapped_testcase_suites:
finished_testcase_suites = set()
for wrapped_testcase_suite in wrapped_testcase_suites:
while wrapped_testcase_suite.result_parent_end.poll():
@@ -434,9 +434,9 @@ def run_forked(testcase_suites):
finished_unread_testcases.add(finished_testcase)
finished_testcase.stdouterr_queue.put(None)
if stop_run:
- while len(testcase_suites) > 0:
+ while testcase_suites:
results.append(TestResult(testcase_suites.pop(0)))
- elif len(testcase_suites) > 0:
+ elif testcase_suites:
new_testcase = TestCaseWrapper(testcase_suites.pop(0),
manager)
wrapped_testcase_suites.add(new_testcase)
@@ -630,7 +630,7 @@ class AllResults(dict):
failed_testcase_ids = result[FAIL]
errored_testcase_ids = result[ERROR]
old_testcase_name = None
- if len(failed_testcase_ids) or len(errored_testcase_ids):
+ if failed_testcase_ids or errored_testcase_ids:
for failed_test_id in failed_testcase_ids:
new_testcase_name, test_name = \
result.get_testcase_names(failed_test_id)
@@ -649,7 +649,7 @@ class AllResults(dict):
old_testcase_name = new_testcase_name
print(' ERROR: {} [{}]'.format(
colorize(test_name, RED), failed_test_id))
- if len(self.testsuites_no_tests_run) > 0:
+ if self.testsuites_no_tests_run:
print('TESTCASES WHERE NO TESTS WERE SUCCESSFULLY EXECUTED:')
tc_classes = set()
for testsuite in self.testsuites_no_tests_run:
@@ -799,7 +799,7 @@ if __name__ == '__main__':
if attempts > 1:
print("Perform %s attempts to pass the suite..." % attempts)
- if run_interactive and len(suites):
+ if run_interactive and suites:
# don't fork if requiring interactive terminal
full_suite = unittest.TestSuite()
map(full_suite.addTests, suites)
@@ -821,7 +821,7 @@ if __name__ == '__main__':
sys.exit(not was_successful)
else:
exit_code = 0
- while len(suites) > 0 and attempts > 0:
+ while suites and attempts > 0:
results = run_forked(suites)
exit_code, suites = parse_results(results)
attempts -= 1