Skip to content

Commit

Permalink
Python unittest skip messages on 3.12.1 and later
Browse files Browse the repository at this point in the history
On Python 3.12.1 and later the message given when no tests are run is
more precise and verbose.  Let's adapt the nrunner selftest to take
that into consideration.

Signed-off-by: Cleber Rosa <[email protected]>
  • Loading branch information
clebergnu committed Dec 13, 2023
1 parent 30be972 commit 3b2a46e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions selftests/unit/nrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,18 @@ def test_runner_python_unittest_skip(self):
runner_klass = runnable.pick_runner_class()
runner = runner_klass()
results = [status for status in runner.run(runnable)]
output1 = (
b"----------------------------------------------------------------------\n"
b"Ran 1 test in "
)
output2 = b"s\n\nOK (skipped=1)\n"
if sys.version_info < (3, 12, 1):
output1 = (
b"----------------------------------------------------------------------\n"
b"Ran 1 test in "
)
output2 = b"s\n\nOK (skipped=1)\n"
else:
output1 = (
b"----------------------------------------------------------------------\n"
b"Ran 0 tests in "
)
output2 = b"\n\nNO TESTS RAN (skipped=1)\n"
output = results[-2]
result = results[-1]
self.assertEqual(result["status"], "finished")
Expand Down

0 comments on commit 3b2a46e

Please sign in to comment.