Repository navigation
Test ERROR: File Not Found Error #8222
Description
Environment data
- VS Code version: 1.39.2 (user setup)
- Extension version (available under the Extensions sidebar): 2019.10.44104
- OS and version: Windows_NT x64 10.0.18363
- Python version (& distribution if applicable, e.g. Anaconda): 3.7.0
- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
- Relevant/affected Python packages and their versions: pytest
Expected behaviour
Pytest Tests work.
Actual behaviour
If I set the top level directory for the Python Test extension to azure-iot-device for pytest, the python extension will be able to discover tests without erroring out, but upon debugging I will get an Error:
ERROR: file not found: ./azure-iot-device/tests/common/pipeline/test_pipeline_stages_base.py::TestEnsureConnectionStageUnknownEvents::test_uses_background_exception_handler[IncomingMQTTMessageEvent]
The issue is that error is cryptic. Running tests in the command prompt there is no error as such. Where is the error coming from? is it from generated code? How to i fix it?
Logs
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
https://gist.github.com/YoDaMa/9b25b078cf4e262ab61f275537bfb37f
Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)
============================= test session starts =============================
platform win32 -- Python 3.7.0, pytest-5.2.1, py-1.8.0, pluggy-0.13.0
rootdir: e:\GitRepos\Python\custom_user_agent, inifile: pytest.ini
plugins: asyncio-0.10.0, cov-2.8.1, mock-1.10.4, testdox-1.2.0, timeout-1.3.3
timeout: 20.0s
timeout method: thread
timeout func_only: False
collected 0 items
- generated xml file: C:\Users\yomaguir\AppData\Local\Temp\tmp-12232X4OzggdFWp6w.xml -
============================ no tests ran in 0.09s ============================
ERROR: file not found: ./azure-iot-device/tests/common/pipeline/test_pipeline_stages_base.py::TestEnsureConnectionStageUnknownEvents::test_uses_background_exception_handler[IncomingMQTTMessageEvent]
Activity
brettcannon commentedon Oct 28, 2019
Are you using just the Python extension for VS Code or do you have another Python extension installed (your comment about the "Python Test extension" suggests you have more than one). If you have another Python extension then please disable the other ones to make sure they are not interfering with our extension.
And when you said "running tests in the command prompt there is no error", is that with the same command the extension uses to execute your tests (which you can see in the Output panel), or are you creating the command yourself? If the latter, please try using the command we use to see if it reproduces the problem.
YoDaMa commentedon Oct 28, 2019
Specifically the Python Extension for VS Code.
YoDaMa commentedon Oct 28, 2019
Brett Cannon (@brettcannon) it's not clear from the logs what specifically the extension is running so I can repro what you are asking. I've included my OUTPUT as a gist above. Can you point me at the line I can paste into my own command prompt to run?
That being said, I'm running
pyestin my top level folder, which is generic, and generally how you run pytest tests... As in literally:brettcannon commentedon Oct 28, 2019
Yoseph Maguire (@YoDaMa) I thought we printed the lint in the Output panel for each test log run, but if that's not the case then we will have it under the general "Python" tab of the Output panel.
kimadeline commentedon Oct 28, 2019
Hi Yoseph Maguire (@YoDaMa) 👋
Could you also copy here the content of the terminal when you run
pytest .from thee:\GitRepos\Python\custom_user_agentfolder (it's therootdirfolder in your log snippet above)?Thanks!
brettcannon commentedon Jan 2, 2020
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on then we will be happy to re-open this issue to pick up where we left off.