Skip to content

Test runner appears to not respect the selected interpreter setting #7215

Closed

Description

Extension version: 2019.9.34474
VS Code version: Code 1.38.0 (3db7e09, 2019-09-03T21:47:00.464Z)
OS version: Darwin x64 18.6.0


In settings.json I selected an interpreter (that has some additional dependencies for pytest installed) via "python.pythonPath". When I run pytest tests from the terminal (with the appropriate interpreter activated) my tests run fine, while the test runner complains

"Test discovery error, please check the configuration settings for the tests."

due to some pytest argument error (presumably caused by not finding the proper dependencies)

Activity

  1. ghost added
    triage-neededNeeds assignment to the proper sub-team
    on Sep 5, 2019
  2. stereobutter commented on Sep 5, 2019

    @stereobutter
    Author

    The issue occurs with a local repo cloned from https://github.com/dry-python/returns where poetry is used to manage dependencies.

  3. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Sep 5, 2019
  4. ericsnowcurrently commented on Sep 6, 2019

    @ericsnowcurrently

    Hi @SaschaSchlemmer. Thanks for letting us know about this. I have some questions:

    • what Python interpreter do you put in your settings.json?
    • what shows up in the "Python Test Log" output panel?
  5. stereobutter commented on Sep 7, 2019

    @stereobutter
    Author
    • The python interpreter I put into my the workspaces settings.json is
      "/Users/sascha/Library/Caches/pypoetry/virtualenvs/returns-py3.6/bin/python"
    • The Python Test Log says
      Traceback (most recent call last):
        File "/Users/sascha/.vscode/extensions/ms-python.python-2019.9.34474/pythonFiles/testing_tools/run_adapter.py", line 18, in <module>
          main(tool, cmd, subargs, toolargs)
        File "/Users/sascha/.vscode/extensions/ms-python.python-2019.9.34474/pythonFiles/testing_tools/adapter/__main__.py", line 90, in main
          parents, result = run(toolargs, **subargs)
        File "/Users/sascha/.vscode/extensions/ms-python.python-2019.9.34474/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 35, in discover
          raise Exception('pytest discovery failed (exit code {})'.format(ec))
      Exception: pytest discovery failed (exit code 1)
      
  6. ericsnowcurrently commented on Oct 7, 2019

    @ericsnowcurrently

    @SaschaSchlemmer, sorry for the delay. The "Python test log" output panel should have included more information than that, such as error output from pytest or the test adapter script we use. Please include that output.

    Also, what command do you see run for test discovery in the "Python" output panel? It should reflect your "python.pythonPath" setting.

  7. LightCC commented on Nov 8, 2019

    @LightCC

    I may have some additional info. I have Python 3.8 installed, but my Python 3.7 folder/exe is my default (interpretter is selected as Python 3.7.4 64-bit, that is the version in my venv, PY_PYTHON 3.7 and only my python37/Scripts folder on the PATH), yet I keep getting complaints that the extension cannot find pytest, even though it is installed via Python 3.7.

    If I click the "pytest is not installed" pop-up "yes" to install pytest, the command is installing pytest using Python 3.8 (and the --user tag).

    I cannot figure out why the Python extension is assuming I want it to use Python 3.8 and it's system and/or user directories as the location for pytest.

  8. ericsnowcurrently commented on Nov 11, 2019

    @ericsnowcurrently

    Thanks for the update. Please answer the following:

    • what is the current "python.pythonPath" setting?
    • do you see that interpreter in the list when you run the "Python: Select Interpreter" command?
    • in the "Python" output panel, what is the command the extension is running for test discovery?
    • what is the full output in the "Python Test Log" output panel?

    Thanks!

  9. brettcannon commented on Jan 8, 2020

    @brettcannon
    Member

    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.

  10. ghost removed on Jan 8, 2020
  11. locked as resolved and limited conversation to collaborators on Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

info-neededIssue requires more information from poster

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions