Skip to content

Test result not found for pytest. #16963

Closed

Description

@ttSpace

Environment data

Version: 1.60.0-insider (user setup)
Commit: 699084f
Date: 2021-08-12T19:13:28.730Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.17134

Build of python-insider: 2021.9.1125171759-dev
Build of jupyter-insider: 2021.8.2025984474

Expected behaviour

There is ✔ shown for the passing tests, ❌ shown for the failing tests

Actual behaviour

Test result not found.

image

Steps to reproduce:

  1. Input below code:
def test_passing():
    assert 42 == 42
def test_failure():
    assert 42 == -13
  1. Run tests with pytest framework
"python.testing.pytestEnabled": true
  1. Pytest installed in current environment.
  2. Run command: "Run All Tests"

Logs

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

User belongs to experiment group 'pythonaa'
User belongs to experiment group 'pythonJediLSP'
User belongs to experiment group 'pythonDiscoveryModuleWithoutWatcher'
User belongs to experiment group 'pythonTensorboardExperiment'
User belongs to experiment group 'PythonPyTorchProfiler'
User belongs to experiment group 'pythonDeprecatePythonPath'
User belongs to experiment group 'pythonSortEnvs'
Python interpreter path: C:\ProgramData\Anaconda3\python.exe
Starting Pylance language server.
Error 2021-08-13 07:02:50: Failed to check if file needs to be fixed [EntryNotFound (FileSystemError): Unable to read file 'c:\Users\vting\AppData\Roaming\Code - Insiders\User\settings.json' (Error: Unable to resolve non-existing file 'c:\Users\vting\AppData\Roaming\Code - Insiders\User\settings.json')
	at _handleError (c:\Users\vting\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:85:159261)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async y.readText (c:\Users\vting\.vscode-insiders\extensions\ms-python.python-2021.9.1125171759-dev\out\client\extension.js:9:338733)
	at async p.doesFileNeedToBeFixed (c:\Users\vting\.vscode-insiders\extensions\ms-python.python-2021.9.1125171759-dev\out\client\extension.js:59:559685)
	at async c:\Users\vting\.vscode-insiders\extensions\ms-python.python-2021.9.1125171759-dev\out\client\extension.js:59:558812
	at async Promise.all (index 0)
	at async p.getFilesToBeFixed (c:\Users\vting\.vscode-insiders\extensions\ms-python.python-2021.9.1125171759-dev\out\client\extension.js:59:558758)
	at async p.updateTestSettings (c:\Users\vting\.vscode-insiders\extensions\ms-python.python-2021.9.1125171759-dev\out\client\extension.js:59:558385)] {
  code: 'FileNotFound'
}
> C:\ProgramData\Anaconda3\python.exe c:\Users\vting\.vscode-insiders\extensions\ms-python.python-2021.9.1125171759-dev\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir c:\Users\vting\Downloads\Test4 -s --cache-clear
cwd: c:\Users\vting\Downloads\Test4
> C:\ProgramData\Anaconda3\python.exe -m pytest --rootdir c:\Users\vting\Downloads\Test4 --override-ini junit_family=xunit1 --junit-xml=C:\Users\vting\AppData\Local\Temp\tmp-46805C7NZ2lIevHo.xml c:\Users\vting\Downloads\Test4
cwd: c:\Users\vting\Downloads\Test4

Activity

  1. karthiknadig commented on Aug 13, 2021

    @karthiknadig
    Member

    Thanks for the report. I was able to repro this.

  2. karrtikr commented on Aug 20, 2021

    @karrtikr

    Verification steps:

    • Install the Insiders build of the Python extension using Python: Switch to Insiders weekly command.
    • Make sure you have "python.experiments.optInto": ["All"], in your user settings. If you did not have it, add it and reload.
    • Create a new folder containing a python file named pytest_test.py. (name is important)
    • Add the following content:
    def test_passing():
        assert 42 == 42
    def test_failure():
        assert 42 == -13
    • Select a Python interpreter and create new terminal.
    • Click the test explorer icon on the explorer tab to the left and click Configure Python tests:
    • Select pytest in the dropdown and select directory containing the tests:
    • If pytest is not installed, install it using pip in the dropdown displayed. Click the refresh icon to rediscover tests in that case.
      image
    • You can also run the following command to install pytest: python -m pip install pytest if no such dropdown is displayed. Do leave a comment in this case.
    • Run all tests using the icon above and verify the tests are run successfully:
  3. locked as resolved and limited conversation to collaborators on Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-testingbugIssue identified by VS Code Team member as probable bugverification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions