Skip to content

Commit a0c9fe5

Browse files
hormskuba-moo
authored andcommitted
tc-testing: don't access non-existent variable on exception
Since commit 255c1c7 ("tc-testing: Allow test cases to be skipped") the variable test_ordinal doesn't exist in call_pre_case(). So it should not be accessed when an exception occurs. This resolves the following splat: ... During handling of the above exception, another exception occurred: Traceback (most recent call last): File ".../tdc.py", line 1028, in <module> main() File ".../tdc.py", line 1022, in main set_operation_mode(pm, parser, args, remaining) File ".../tdc.py", line 966, in set_operation_mode catresults = test_runner_serial(pm, args, alltests) File ".../tdc.py", line 642, in test_runner_serial (index, tsr) = test_runner(pm, args, alltests) File ".../tdc.py", line 536, in test_runner res = run_one_test(pm, args, index, tidx) File ".../tdc.py", line 419, in run_one_test pm.call_pre_case(tidx) File ".../tdc.py", line 146, in call_pre_case print('test_ordinal is {}'.format(test_ordinal)) NameError: name 'test_ordinal' is not defined Fixes: 255c1c7 ("tc-testing: Allow test cases to be skipped") Signed-off-by: Simon Horman <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 0373d71 commit a0c9fe5

File tree

1 file changed

+0
-1
lines changed
  • tools/testing/selftests/tc-testing

1 file changed

+0
-1
lines changed

tools/testing/selftests/tc-testing/tdc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ def call_pre_case(self, caseinfo, *, test_skip=False):
143143
except Exception as ee:
144144
print('exception {} in call to pre_case for {} plugin'.
145145
format(ee, pgn_inst.__class__))
146-
print('test_ordinal is {}'.format(test_ordinal))
147146
print('testid is {}'.format(caseinfo['id']))
148147
raise
149148

0 commit comments

Comments
 (0)