summaryrefslogtreecommitdiff
path: root/test/py
diff options
context:
space:
mode:
authorHeinrich Schuchardt <[email protected]>2025-11-23 23:56:53 +0100
committerTom Rini <[email protected]>2025-12-05 08:54:44 -0600
commitc448c933b9c2f55c6eff996fcd281c40e65d6eda (patch)
tree5aa93316b7e25a9547e8bb832a8ea2467947528d /test/py
parent9eeed950445aa1e5f637f2e350986a0c45b0317c (diff)
test: Let pytest indicate skipped C unit tests
We invoke the ut command in test_ut.py. Currently we only check for failures. Instead we should also indicate if sub-tests were skipped. With this change we will get output like the following for skipped tests: test/py/tests/test_ut.py ..sssss......ss..............s.sssss.s.s... ================================ short test summary info ================================ SKIPPED [1] test/py/tests/test_ut.py:597: Test addrmap addrmap_test_basic has 1 skipped sub-test(s). SKIPPED [1] test/py/tests/test_ut.py:597: Test bdinfo bdinfo_test_eth has 4 skipped sub-test(s). Signed-off-by: Heinrich Schuchardt <[email protected]>
Diffstat (limited to 'test/py')
-rw-r--r--test/py/tests/test_ut.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py
index cdf54adc600..6d535b5206d 100644
--- a/test/py/tests/test_ut.py
+++ b/test/py/tests/test_ut.py
@@ -11,6 +11,7 @@ import collections
import gzip
import os
import os.path
+import re
import pytest
import utils
@@ -589,3 +590,9 @@ def test_ut(ubman, ut_subtest):
else:
output = ubman.run_command('ut ' + ut_subtest)
assert output.endswith('failures: 0')
+ lastline = output.splitlines()[-1]
+ if "skipped: 0," not in lastline:
+ match = re.search(r'skipped:\s*(\d+),', lastline)
+ if match:
+ count = match.group(1)
+ pytest.skip(f'Test {ut_subtest} has {count} skipped sub-test(s).')