Support unittest.subTest context manager (Python 3.4+)See original GitHub issue
Python 3.4 added the unittest.subTest() context manager. It would be wonderful if Green elevated the information from subTest() up to the top level.
I think it’s best displayed with an example.
Code (taken directly from the subTest() docs):
class NumbersTest(unittest.TestCase): def test_even(self): """ Test that numbers between 0 and 5 are all even. """ for i in range(0, 6): with self.subTest(i=i): self.assertEqual(i % 2, 0)
See how the standard unittest module will show you
(i=5) on the fail line?
Here’s a mockup of how Green might look when utilizing the subTest feature:
green project -vvv
I don’t think that the subTest items need to be displayed for lower verbosity levels. I also don’t think that each failed iteration needs the Traceback (like is done with unittest) unless verbosity is set to the highest level.
- Created 8 years ago
- Comments:12 (9 by maintainers)