pytest-sugar
pytest-sugar copied to clipboard
Integration with pytest-subtests
trafficstars
When using pytest-subtests and pytest-sugar, the actual subtest name is not reported in the results.
example:
import unittest
class T(unittest.TestCase):
def test_foo(self):
for i in range(5):
with self.subTest("custom message", i=i):
self.assertEqual(i % 2, 0)
if __name__ == "__main__":
unittest.main()
output
Test session starts (platform: linux, Python 3.8.3, pytest 5.4.3, pytest-sugar 0.9.4)
rootdir: /home/cdk/dev/expecthon
plugins: django-3.9.0, sugar-0.9.4, cov-2.10.0, black-0.3.10, subtests-0.3.2
bla.py ⨯✓ 100% ██████████
======================================= short test summary info =======================================
FAILED bla.py::T::test_foo - AssertionError: 1 != 0
FAILED bla.py::T::test_foo - AssertionError: 1 != 0
Results (0.13s):
1 passed
2 failed
- bla.py:5 T.test_foo
- bla.py:5 T.test_foo
Expected output
Test session starts (platform: linux, Python 3.8.3, pytest 5.4.3, pytest-sugar 0.9.4)
rootdir: /home/cdk/dev/expecthon
plugins: django-3.9.0, sugar-0.9.4, cov-2.10.0, black-0.3.10, subtests-0.3.2
bla.py ⨯✓ 100% ██████████
======================================= short test summary info =======================================
FAILED bla.py::T::test_foo (custom message, i=1) - AssertionError: 1 != 0
FAILED bla.py::T::test_foo (custom message, i=3) - AssertionError: 1 != 0
Results (0.13s):
1 passed
2 failed
- bla.py:5 T.test_foo
- (custom message, i=1)
- (custom message, i=3)
Maybe you could try --old-summary as a fallback
Can i do something regarding the PR? @Teemu
I just need to do general maintenance on this project first
Alright. Say the word if you need help.