-
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
Testing always raises "Unable to read file" #10658
Comments
Hi @sralloza, thank you for reaching out! I extracted your comment about the JUnit warning in a different issue (#10673), thank you for reporting it 👍 Does this error get raised when you run a single failing test, when you run all tests, or both? What does your folder structure look like? Do you have a What happens if you run
Thanks! |
Here you have the requested info:
Both.
I don't have a
If I run the tests using pytest directly in terminal, the output is what you would expect, without any For some reason, now I can't reproduce my own bug. I created a test designed to fail, just like I did when I submitted this issue, and it just works fine. Now, executing the test I may add that this bug was present in other projects, too. I think it may be related with the mock library, because in one occasion when I commented a hole test that was using mock badly, the bug disappeared. But the moment I uncommented that test, the bug returned. It's something that may be useful, although I can't 100% confirm this. |
Thank you for investigating the issue and providing a sample repro case! Seems like there's an issue with how we parse pytest's output 🔍 |
I have the same problem, looking forward to a fix. |
I think it has to do with a module importing issue. I was trying to resolve a circular relative import issue and encountered this. |
Is there a fix for this yet? I think one was proposed here: This just makes it difficult to work. Thanks! |
Experiencing this today, not a fun one! |
I think this was closed in #16769. Feel free to comment if you are still experiencing this issue. |
Environment data
"python.jediEnabled"
set to; more info How to update the language server to the latest stable version #3977): jedipython.languageServer
setting: MicrosoftExpected behaviour
Launching a test should not raise any
Unable to read file
error.Actual behaviour
When launching a test (pytest is enabled as testing framework) and it fails, an error is raised:
Error: Error: cannot open file:///d%3A/.scripts/vcm/c. Detail: Unable to read file 'd:\.scripts\vcm\c' (Error: Unable to resolve non-existing file 'd:\.scripts\vcm\c')
.The route of the workspace is
d:\.scripts\vcm
, but there is no file namedc
. If I create a file namedc
, the error changes toError: Error: Illegal value for 'line'
.If at first all tests are ok, no error is raised. But when the first tests fail, then after every test (even if it doesn't fail) the error of the
c
file appears again.The
Unable to read file
error was mentioned in #6548, and theIllegal value for line
error was mentioned in #4334.I have tried to disable all extensions except for vscode-python, but the bug is still there.
Also, running tests with pytests shows the
PytestDeprecationWarning: The 'junit_family' default value will change to 'xunit2' in pytest 6.0. Add 'junit_family=xunit1' to your pytest.ini file to keep the current format in future versions of pytest and silence this warning.
Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
I tried to create a blank project with a similar structure as mine, but I can't recreate the bug
Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Output of
Python Test Log
: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`)
To provide more information, these are my settings:
Global settings:
Workspace settings:
The text was updated successfully, but these errors were encountered: