kondratyev-nv / vscode-python-test-adapter

Python Test Adapter for the VS Code Test Explorer
https://marketplace.visualstudio.com/items?itemName=LittleFoxTeam.vscode-python-test-adapter
MIT License
117 stars 27 forks source link

No more prints in Output? #266

Open Ch1lled opened 2 years ago

Ch1lled commented 2 years ago

In 0.6.8 there was the - Captured Out - section in Output where all print() results was shown. It's gone in 0.7.0 so how to browse prints now?

And also why there are no more logs for successful tests? image

kondratyev-nv commented 2 years ago

@Ch1lled Thank you for the issue! Yes, in 0.7.0 I've updated the behavior to match default pytest capturing (related to #245). The output will be shown on click for failed test image

To enable full capturing you can add "--override-ini=junit_logging=all" to "python.testing.pytestArgs" setting or, if you use pytest ini file, junit_logging=all to that file.

Let me know if this helps!

Ch1lled commented 2 years ago

That's exactly what I needed, thanks a lot! Adding a setting causes another issue but looks like test runs fine: image

VSCode ver. 1.59.0

kondratyev-nv commented 2 years ago

Ok, the default settings for unittest were broken in the Python extension. I'll see how to fix this, but as a quick fix, I can suggest adding "python.testing.unittestArgs": [] to the settings. Let me know if this helps!

Ch1lled commented 2 years ago

Nope, still has an error.

image

kondratyev-nv commented 2 years ago

@Ch1lled I meant to set this directly in JSON 🙂 If you're using UI, then just remove all items from the list image

Ch1lled commented 2 years ago

Oh, didn't get it) After removal there is no more error, thanx, I appreciate your help a lot.

k870611 commented 2 years ago

for unittest

I have add "python.testing.unittestArgs": [] in settings.json and remove all Item in settings but output still not showing in Test Explorer

VS Code version: 1.59.0 (system setup) Python Test Explorer for Visual Studio Code version: v0.7.0

settings.json: { "python.testing.unittestArgs": [], "python.testing.pytestEnabled": false, "python.testing.nosetestsEnabled": false, "python.testing.unittestEnabled": true }

kondratyev-nv commented 2 years ago

@k870611 The recommendation to set "python.testing.unittestArgs": [] is only when tests are executed with pytest and it does not affect output. For unittest I actually recommend setting python.testing.unittestArgs with appropriate values.

For unittest, there would be no output if a test is executed successfully and there is no output to standard output (e.g. print statements). To verify you can run python -m unittest discover <your command line args for start directory and pattern> and see if there would be any additional output (except from unittest).

If it does not resolve your problem, I can suggest creating a new issue and add additional details like screenshots, python version, and perfectly a reproducable example.

k870611 commented 2 years ago

Sorry I don't know does it is cause by myself (like wrong config or....) but In cmd and PYTHON is have output

CMD: sshot-5

PYTHON sshot-3

but not in Test Explorer sshot-4

kondratyev-nv commented 2 years ago

@k870611 Test outputs are not aggregated, can you try clicking on a specific test that should contain output?