-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No logs? #18
Comments
Hi @tzachshabtay, Thanks for the report, that's clearly a bug. |
Are there any news on this issue? I like this plug-in and started using it in a project. My current trick to see the test output of the failures is to run the tests with |
Hi @icemac thanks for the ping! I apologize, I have not allocated time to work on this plugin lately because of more important stuff happening in pytest/xdist/etc. This plugin is not abandoned though, I will try harder to allocate more time for it in the next days. 👍 |
|
Hi, └─ $ ▶ pip freeze | grep subtest
pytest-subtests==0.3.1 Without subtests installed it works just fine :) |
Hi @r-or, Can you show a test which reproduces the issue? Thanks! |
@nicoddemus The issue still persist on my end on the version 0.3.1
I'll post a test to reproduce it shortly |
Below is running from my local - different environment than above, but the behavior is exactly the same - not getting the Captured stdout call logs Test: # test_subtest.py
import unittest
class PytestSubtestTest(unittest.TestCase):
def test_subtest_stdout(self):
for i in range(2):
with self.subTest(i=i):
print(f"{i}: Print something to stdout")
self.assertEqual(0, 1) Output: $ pytest -o log_cli=true test_subtest.py
================================================================================ test session starts ================================================================================
platform darwin -- Python 3.7.7, pytest-5.4.3, py-1.8.1, pluggy-0.13.1
rootdir: /Users/w.son/Projects/git.soma.salesforce.com/TESTS/presto-fit-tests/src/test/python
plugins: subtests-0.3.1
collected 1 item
test_subtest.py::PytestSubtestTest::test_subtest_stdout
test_subtest.py::PytestSubtestTest::test_subtest_stdout PASSED [100%]
===================================================================================== FAILURES ======================================================================================
____________________________________________________________________ PytestSubtestTest.test_subtest_stdout (i=0) ____________________________________________________________________
self = <test_subtest.PytestSubtestTest testMethod=test_subtest_stdout>
def test_subtest_stdout(self):
for i in range(2):
with self.subTest(i=i):
print(f"{i}: Print something to stdout")
> self.assertEqual(0, 1)
E AssertionError: 0 != 1
test_subtest.py:9: AssertionError
____________________________________________________________________ PytestSubtestTest.test_subtest_stdout (i=1) ____________________________________________________________________
self = <test_subtest.PytestSubtestTest testMethod=test_subtest_stdout>
def test_subtest_stdout(self):
for i in range(2):
with self.subTest(i=i):
print(f"{i}: Print something to stdout")
> self.assertEqual(0, 1)
E AssertionError: 0 != 1
test_subtest.py:9: AssertionError
============================================================================== short test summary info ==============================================================================
FAILED test_subtest.py::PytestSubtestTest::test_subtest_stdout - AssertionError: 0 != 1
FAILED test_subtest.py::PytestSubtestTest::test_subtest_stdout - AssertionError: 0 != 1
============================================================================ 2 failed, 1 passed in 0.11s ============================================================================ |
Also, it's a different question, but why do I get 2 failed and 1 passed in the above instead of just 2 failures? |
Thanks, created #26 as follow up, now the issue is clear! Sorry about the delay.
Because the test containing the subtests passed. This is to differentiate from the case where it also fails after the class PytestSubtestTest(unittest.TestCase):
def test_subtest_stdout(self):
for i in range(2):
with self.subTest(i=i):
print(f"{i}: Print something to stdout")
self.assertEqual(0, 1)
assert 0, "test failed" This will get you 3 failures: 2 from the subtests, and one from the failing |
Thanks for the plugin, subtests are properly named now. However...
After installing the plugin the whole section in the output showing the logs is gone (i.e the
"Captured stdout call"
and"Captured log call"
that appear in the bottom without this plugin).It's very hard to debug failing tests without logs, making this plugin currently unusable for me.
The text was updated successfully, but these errors were encountered: