forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Environment data
- VS Code version:
1.32.0 - Extension version (available under the Extensions sidebar):
2019.2.5558 - OS and version:
macOS Mojave 10.14.3 - Python version (& distribution if applicable, e.g. Anaconda):
3.7 - Type of virtual environment used (N/A | venv | virtualenv | conda | ...):
N/A - Relevant/affected Python packages and their versions:
pytest==4.3.0
Expected behaviour
Run Test and Debug Test should execute from the same directory.
Actual behaviour
Run Test and Debug Test execute from different directories.
In my case, this means that all my python unit tests pass when I use Run Test, but I encounter ModuleNotFoundError using Debug Test.
It is unclear how to change the execution directories for Debug Test, relative to the ${workspaceFolder}, or if this is even possible.
^ Notice in the screenshot above that the sys.path is different for Run Test vs Debug Test.
Asides:
- I have essentially nothing in my Global
settings.jsonfile. - I've reproduced this issue on Two different macOS systems.
Steps to reproduce:
git clonemy demo/example github project (minimum code/files): https://github.com/bfrizb/demo_repo ANDgit checkoutthevscode-python/issues/4674branch.- Open
demo_repoin VSCode - Try
Run TestandDebug Testto observe the difference in behavior. Here is a video demonstrating the problem.
Logs
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
For Run Test
============================= test session starts ==============================
platform darwin -- Python 3.7.0, pytest-4.3.0, py-1.8.0, pluggy-0.9.0
rootdir: /Users/bfrisbie/Downloads/test_repo/solution/src/python, inifile:
collected 1 item
tests/myfile_test.py F [100%]
=================================== FAILURES ===================================
___________________________________ test_add ___________________________________
def test_add():
print(sys.path)
> assert False
E assert False
tests/myfile_test.py:7: AssertionError
----------------------------- Captured stdout call -----------------------------
['/Users/bfrisbie/Downloads/test_repo/solution/src/python', '/Users/bfrisbie/Downloads/test_repo/solution/src/python', '/Users/bfrisbie/Downloads/test_repo/solution/src/python/src', '/Users/bfrisbie/Downloads/test_repo/solution/src/python/test', '/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload', '/Users/bfrisbie/Library/Python/3.7/lib/python/site-packages', '/usr/local/lib/python3.7/site-packages']
- generated xml file: /var/folders/l8/518s_8n51cj0lhp_5yjc55sm0000gp/T/tmp-29170sIk8mMwTxmB4.xml -
=========================== 1 failed in 0.04 seconds ===========================
For Debug Test:
============================= test session starts ==============================
platform darwin -- Python 3.7.0, pytest-4.3.0, py-1.8.0, pluggy-0.9.0
rootdir: /Users/bfrisbie/Downloads/test_repo/solution/src/python, inifile:
collected 1 item
tests/myfile_test.py F [100%]
=================================== FAILURES ===================================
___________________________________ test_add ___________________________________
def test_add():
print(sys.path)
> assert False
E assert False
tests/myfile_test.py:7: AssertionError
----------------------------- Captured stdout call -----------------------------
['/Users/bfrisbie/Downloads/test_repo/solution/src/python', '/Users/bfrisbie/Downloads/test_repo/solution/src/python', '/Users/bfrisbie/Downloads/test_repo/solution/src/python/src', '/Users/bfrisbie/Downloads/test_repo/solution/src/python/test', '/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload', '/Users/bfrisbie/Library/Python/3.7/lib/python/site-packages', '/usr/local/lib/python3.7/site-packages']
- generated xml file: /var/folders/l8/518s_8n51cj0lhp_5yjc55sm0000gp/T/tmp-29170sIk8mMwTxmB4.xml -
=========================== 1 failed in 0.04 seconds ===========================
Metadata
Metadata
Assignees
Labels
No labels
