Skip to content
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

Test discovery should expand system variables in .env #7650

Closed
karthiknadig opened this issue Sep 27, 2019 · 2 comments
Closed

Test discovery should expand system variables in .env #7650

karthiknadig opened this issue Sep 27, 2019 · 2 comments
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@karthiknadig
Copy link
Member

Environment data

  • VS Code version: 1.38.1
  • Extension version (available under the Extensions sidebar): 2019.9.34911
  • OS and version: Windows
  • 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
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): LS

Expected behaviour

Should expand ${workspaceFolder}/src in .env while doing test discovery or test runs.
.env:

PYTHONPATH=${workspaceFolder}/src

Actual behaviour

Does not expand ${workspaceFolder} for test discovery.

Steps to reproduce:

  1. Clone ptvsd, open it and wait for extension to load
  2. Once you see tests are discovered.
  3. Open .env file and change from PYTHONPATH=./src to PYTHONPATH=${workspaceFolder}/src
  4. Reload.
  5. Test discovery fails.

Logs

Python Test Logs.

python c:\Users\kanadig\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\testing_tools\run_adapter.py discover pytest -- -s --cache-clear
Test Discovery failed: 
Error: ImportError while loading conftest 'c:\GIT\ptvsd\tests\conftest.py'.
tests\__init__.py:52: in <module>
    from ptvsd.common import json, log
E   ModuleNotFoundError: No module named 'ptvsd'
@karthiknadig karthiknadig added bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team labels Sep 27, 2019
@DonJayamanne
Copy link

Duplicate of #7581

@DonJayamanne DonJayamanne marked this as a duplicate of #7581 Sep 28, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Sep 28, 2019
@DonJayamanne
Copy link

Sorry, this isn't a duplicate of #7581.
Closing this as ${workspaceFolder} and such variables are not supported in .env files.

.env files is not a concept that was coined by the VS Code extension, this is in use by other tools.
We won't be adding support for such variables that are specific to the context of the vs code execution environment as these will not work outside VS Code (making the .env file less portable and more VS Code specific (which they aren't)

@karthiknadig

@lock lock bot locked as resolved and limited conversation to collaborators Oct 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants