-
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
Running tests via test explorer breaks when getcwd is mocked #23101
Comments
In our code we use the cwd to add to solve the problem outlined in this PR: #21399. Would using pathlib cwd as a fallback work? We need this information to make the extension work so we would have to get it somehow. |
@eleanorjboyd We just need to capture CWD on import, that should address this. |
@jahan01 two things, |
@eleanorjboyd: Yes it is still failing with the latest vscode (Version: 1.89.0 (Universal)) and python extension (v2024.6.0). I given the machine info already in description. Do you require more info than what is given ?
Make: Apple M2 Pro |
Hi, sorry to clarify I have created the following workspace based on your example and am getting the test to pass. Does this fail on your machine? If so can you update versions of the extension / vscode and try again. If it doesn't break let me know what about my configuration of my workspace differs from yours |
closing due to inactivity- please comment and I can reopen if you are able to follow up on my above message. Thanks |
Type: Bug
Behaviour
Expected vs. Actual
In case where os.getcwd() is mocked / patched in the test case, executing it via test explorer throws exception.
Running the same test case via terminal works fine. Also works fine when run with pycharm's test explorer as well
Steps to reproduce:
Configure test framework as pytest.
Run test via test explorer UI. You ll see below exception
Diagnostic data
python.languageServer
setting: PylanceOutput for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)User Settings
Extension version: 2024.2.1
VS Code version: Code 1.87.2 (Universal) (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:21:31.043Z)
OS version: Darwin arm64 23.3.0
Modes:
The text was updated successfully, but these errors were encountered: