You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pytest results in VSCode should show logging. #21781
Thank you for your issue report. We are looking into this now! In the meantime, you are likely on the new testing rewrite and this is why you saw a change in behavior. You can opt out of the rewrite as I get this fix in by setting this in your user settings: "python.experiments.optOutFrom": ["pythonTestAdapter"],. If this doesn't work let me know as this will mean it is a different issue. Thank you and I will send updates in this thread as I get a fix in.
Hi! After investigating this further I believe that what you are seeing is actually the desired behavior. If you run this from the command line you see the output in the screenshot below (as you included). As you can see pytest actually splits it into sections, the failure section which lists the test that was run which has the error and any stack trace then another section for "Captured Log Output" which is where you will see the logging message. The logs are not split by test as known to pytest. Therefore when pytest is done, the per test message it produces is what is displayed in the pop up since that is all the information pytest provides.
Hello I have spent a while digging into this issue specifically because of #21861. In my investigation, the output (which is where logging is sent) is separate from the stack trace and message that pytest saves for failed tests which is what is shown per test. Since this is just output, and there is no way good way to capture the output perfectly per test run while still supplying the logging I don't think it is realistic for us to do this at this time. If this idea gets more traction I can rethink but design-wise pytest doesn't split output by test so with the goal of replicating pytest in our extension this is not something we necessarily want to provide.
Activity
[-]pytest results should show logging.[/-][+]pytest results in VSCode should show logging.[/+]eleanorjboyd commentedon Aug 9, 2023
Thank you for your issue report. We are looking into this now! In the meantime, you are likely on the new testing rewrite and this is why you saw a change in behavior. You can opt out of the rewrite as I get this fix in by setting this in your user settings:
"python.experiments.optOutFrom": ["pythonTestAdapter"],. If this doesn't work let me know as this will mean it is a different issue. Thank you and I will send updates in this thread as I get a fix in.eleanorjboyd commentedon Aug 17, 2023
Hi! After investigating this further I believe that what you are seeing is actually the desired behavior. If you run this from the command line you see the output in the screenshot below (as you included). As you can see pytest actually splits it into sections, the failure section which lists the test that was run which has the error and any stack trace then another section for "Captured Log Output" which is where you will see the logging message. The logs are not split by test as known to pytest. Therefore when pytest is done, the per test message it produces is what is displayed in the pop up since that is all the information pytest provides.
eleanorjboyd commentedon Aug 17, 2023
I was incorrect this can be done- reopening to investigate. Sorry about that
eleanorjboyd commentedon Oct 4, 2023
Hello I have spent a while digging into this issue specifically because of #21861. In my investigation, the output (which is where logging is sent) is separate from the stack trace and message that pytest saves for failed tests which is what is shown per test. Since this is just output, and there is no way good way to capture the output perfectly per test run while still supplying the logging I don't think it is realistic for us to do this at this time. If this idea gets more traction I can rethink but design-wise pytest doesn't split output by test so with the goal of replicating pytest in our extension this is not something we necessarily want to provide.