Skip to content

unitttest discovery and run does not work anymore after last update #1095

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

Closed
mehmetilker opened this issue Mar 16, 2018 · 4 comments
Closed
Labels
area-testing info-needed Issue requires more information from poster

Comments

@mehmetilker
Copy link

unittest discovery and run was working until I have updated to last version.
I have updated VS Code and Python extension to last version in the same time. I am not which one caused the problem.

Environment data

  • VS Code version: 1.21.1
    Version 1.21.1
    Commit 79b44aa704ce542d8ca4a3cc44cfca566e7720f1
    Date 2018-03-14T14:46:47.128Z
    Shell 1.7.9
    Renderer 58.0.3029.110
    Node 7.9.0
    Architecture x64
  • Extension version (available under the Extensions sidebar): 2018.2.1
  • OS and version: Win 10.0.16299 Build 16299
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.4 / pip 9.0.1
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions:unittest

Actual behavior

Discover Tests result with "No tests discovered, please check the configuration settings for the tests."

Expected behavior

Display available tests.

Steps to reproduce:

  1. Create folder and put a unit test file according to documentation
    https://docs.python.org/3/library/unittest.html
  2. Create virtual environment with : py -m venv [envname]
  3. Activate venv
  4. Click Run Tests and configure for first execution with following settings in .vscode/settings.json
    {
    "python.pythonPath": "${workspaceFolder}\_env\Scripts\python.exe",
    "python.unitTest.unittestArgs": [
    "-v",
    "-s",
    "./_env",
    "-p",
    "*test.py"
    ],
    "python.unitTest.unittestEnabled": true
    }
  5. Click Discover tests.
  6. Alert will be shown with a message "No tests discovered, please check the configuration settings for the tests." & Disable Tests.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

No output

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

No output
@DonJayamanne
Copy link

Where are your tests files located? Are they inside the virtual environment?

@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug area-testing info-needed Issue requires more information from poster labels Mar 16, 2018
@mehmetilker
Copy link
Author

Folder structure is as follows. So not inside but next to it.

/projectfolder
----/_env
----/xtest.py

@DonJayamanne
Copy link

Then please change the settings in settings.json from ./_env", to ..
The way you have configured it, you're telling unit tests to look for tests in the ./_env directory.
Please check the documentation here: https://docs.python.org/3/library/unittest.html#cmdoption-unittest-discover-s

@DonJayamanne DonJayamanne added closed-question and removed bug Issue identified by VS Code Team member as probable bug labels Mar 16, 2018
@mehmetilker
Copy link
Author

Sorry to take your time. My mistake.
I created new project folder to reproduce the problem but I created config file wrong.

Original problem was that there was undefined variable problem in unit test file and instead of displaying that error in console, extension display alert saying that "No tests discovered, please check the configuration settings for the tests."

Thanks.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants