@unittest.skip doesn't print anything in Python <= 3.7

אורי uri at speedy.net
Thu Feb 11 15:25:27 EST 2021


Hi,

https://stackoverflow.com/questions/66161394/unittest-skip-doesnt-print-anything-in-python-3-7

We are using Django with unittest. Some tests are skipped with the
@unittest.skip decorator. But if I run the tests with Python 3.6 or 3.7, I
get a number of tests passed (Ran 993 tests / OK), and if I run the same
tests with Python 3.8, I get the same number of tests but with some tests
skipped (Ran 993 tests / OK (skipped=4)). I would like to know if the same
tests were also skipped with Python 3.6 and 3.7, or only with Python 3.8?
And why do I get the skipped output only with Python 3.8? And is the number
993 including the skipped tests or not including them? Is one of the
outputs incorrect? Because it doesn't make sense that the output is
different for different versions of Python and I don't understand the
reason for this difference. I didn't find it documented in the
documentation.

Our code is open source, and you can see for example a skipped test here.

*Update:* I added 4 more tests with the decorator @unittest.skip. When I
run all the tests with Python 3.8, I get this output: Ran 997 tests / OK
(skipped=8) (with an s for every skipped test, like before). But if I run
the tests with Python 3.6 or 3.7, I get this output: Ran 997 tests / OK and
there are no s in the output, like before (I get 997 dots). Although I have
4 more tests than before.

The tests I added raise an exception, so if they would not be skipped they
would fail.

I think the skipped tests are skipped in all Python versions, but in Python
3.6 and 3.7 there is no output about them being skipped. Is it a bug?

אורי
uri at speedy.net


More information about the Python-list mailing list