-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Tests not discovered when using --black or --pylama in setup.cfg #6994
Comments
Hi @hoonhout 👋 thank you for reporting this issue! I tried reproducing your issue, however I don't get the same logs as what you pasted.
def test_api():
print("test api")
pass
> /anaconda3/bin/python ~/.vscode/extensions/ms-python.python-2019.8.30787/pythonFiles/testing_tools/run_adapter.py discover pytest -- -s --cache-clear
equivalent command: /anaconda3/bin/python -m pytest --black --collect-only -s --cache-clear
ERROR: usage: run_adapter.py [options] [file_or_dir] [file_or_dir] [...]
run_adapter.py: error: unrecognized arguments: --black
inifile: /Users/kimiguel/Documents/Sandbox/conda-pytest/setup.cfg
rootdir: /Users/kimiguel/Documents/Sandbox/conda-pytest
Traceback (most recent call last):
File "/Users/kimiguel/.vscode/extensions/ms-python.python-2019.8.30787/pythonFiles/testing_tools/run_adapter.py", line 18, in <module>
main(tool, cmd, subargs, toolargs)
File "/Users/kimiguel/.vscode/extensions/ms-python.python-2019.8.30787/pythonFiles/testing_tools/adapter/__main__.py", line 90, in main
parents, result = run(toolargs, **subargs)
File "/Users/kimiguel/.vscode/extensions/ms-python.python-2019.8.30787/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 36, in discover
raise Exception('pytest discovery failed (exit code {})'.format(ec))
Exception: pytest discovery failed (exit code 4) Could you provide me with a sample test file or repo? Additionally, I have a couple of questions:
Thanks! |
Hi @kimadeline, Thanks for looking into the issue. I just realised that I forgot to mention that I'm running inside a Docker container using the Visual Studio Code Remote - Containers extension. I did not test if the problem exists outside Docker, but I put a minimal (not) working example in this repo: https://github.com/hoonhout/issue-6994 If you open this repo in VSCode and reload the window in a DevContainer, tests will not be discovered unless you remove the options Bas |
Thank you for providing more information and a sample repo, I could reproduce your issue using it 👍 📝 A few notes:
|
I've got the same using
|
Hello! I have reviewed this issue and given the architectural changes of the testing rewrite, this issue should no longer exist on the rewrite. Therefore I am going to close this issue but please comment or open a new issue if you are still seeing a problem when you try this yourself! To use the rewrite yourself just add Thanks! |
Environment data
"python.jediEnabled"
set to; more info How to update the language server to the latest stable version #3977): noExpected behaviour
pytest
tests are discovered by extension and displayed in theTest
panel;CodeLens
options are added to the test functions.Actual behaviour
pytest
tests are discovered by extension, but not displayed in theTest
panel; noCodeLens
options are added to the test functions.Test discovery exits with code
3
if and only if the options--black
and/or--pylama
are added to the pytest comment through thesetup.cfg
file ([tool:pytest]
->addopts
)Steps to reproduce:
test_api.py
file with atest_api
function..vscode/settings.json
:--black
and/or--pylama
tosetup.cfg
->[tool:pytest]
->addopts
.Ctrl-Shift-P
->Python: Discover tests
Logs
Truncated output for
Python Test Log
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython Test Log
)Related
Might be related to #5458 (comment)
The text was updated successfully, but these errors were encountered: