Closed csm10495 closed 5 years ago
Hello @csm10495 👋 Thank you for reaching out and providing a link to your repo 👍 pytest's conventions for Python test discovery specify that pytest will:
search for
test_*.py
or*_test.py
files.
If you rename your tests.py
file the tests will be discovered accordingly (here I renamed it to test_csmlog.py
):
Please note thatpython.testing.pytestArgs
should contain the path to the root folder of your tests and not the path to a file:
"python.testing.pytestArgs": [
"csmlog/tests" // "csmlog" works too
]
Yay! Thank you so much!
Environment data
"python.jediEnabled"
set to; more info #3977): trueExpected behaviour
Should be able to easily discover tests in VS Code via Pytest.
Actual behaviour
I have a sample project, with some unit tests written via pytest. I can't seem to get them to discover using VS Code: https://github.com/csm10495/csmlog
I set workspace settings as follows (when working from the topmost folder of the repo:
and yet no matter what I do, I see this:
and this in the Python Test Log:
A .pytest_cache folder is generated with empty nodeids/stepwise files.
Of course, I can run the tests through pytest directly like so:
or...
Steps to reproduce:
Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Output from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
; turn on source maps to make any tracebacks be useful by runningEnable source map support for extension debugging
)