aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/kunit/kunit_tool_test.py
diff options
context:
space:
mode:
authorDaniel Latypov <dlatypov@google.com>2022-11-03 10:47:38 -0700
committerShuah Khan <skhan@linuxfoundation.org>2022-12-12 14:13:47 -0700
commitf473dd9488d910aab109e8c6a2e4181125ca322a (patch)
tree611c846a1f883dcf850a081d62a68942ba33fad4 /tools/testing/kunit/kunit_tool_test.py
parentkunit: tool: print summary of failed tests if a few failed out of a lot (diff)
downloadwireguard-linux-f473dd9488d910aab109e8c6a2e4181125ca322a.tar.xz
wireguard-linux-f473dd9488d910aab109e8c6a2e4181125ca322a.zip
kunit: tool: make TestCounts a dataclass
Since we're using Python 3.7+, we can use dataclasses to tersen the code. It also lets us create pre-populated TestCounts() objects and compare them in our unit test. (Before, you could only create empty ones). Signed-off-by: Daniel Latypov <dlatypov@google.com> Reviewed-by: David Gow <davidgow@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/kunit/kunit_tool_test.py')
-rwxr-xr-xtools/testing/kunit/kunit_tool_test.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py
index 7dcd67003b23..440a273f1d21 100755
--- a/tools/testing/kunit/kunit_tool_test.py
+++ b/tools/testing/kunit/kunit_tool_test.py
@@ -182,9 +182,7 @@ class KUnitParserTest(unittest.TestCase):
kunit_parser.extract_tap_lines(
file.readlines()))
# A missing test plan is not an error.
- self.assertEqual(0, result.counts.errors)
- # All tests should be accounted for.
- self.assertEqual(10, result.counts.total())
+ self.assertEqual(result.counts, kunit_parser.TestCounts(passed=10, errors=0))
self.assertEqual(
kunit_parser.TestStatus.SUCCESS,
result.status)