Skip to content

Test result not found for pytest. #16963

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
ttSpace opened this issue Aug 13, 2021 · 2 comments · Fixed by #16967
Closed

Test result not found for pytest. #16963

ttSpace opened this issue Aug 13, 2021 · 2 comments · Fixed by #16967
Assignees
Labels
area-testing bug Issue identified by VS Code Team member as probable bug verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@ttSpace
Copy link

ttSpace commented Aug 13, 2021

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 (ViewOutput, 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

@ttSpace ttSpace added the triage-needed Needs assignment to the proper sub-team label Aug 13, 2021
@karthiknadig
Copy link
Member

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

@karthiknadig karthiknadig added area-testing bug Issue identified by VS Code Team member as probable bug needs PR and removed triage-needed Needs assignment to the proper sub-team labels Aug 13, 2021
@karthiknadig karthiknadig added this to the August 2021 milestone Aug 13, 2021
@karthiknadig karthiknadig added the verification-steps-needed Steps to verify are needed for verification label Aug 19, 2021
@karrtikr
Copy link

karrtikr commented Aug 20, 2021

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:

@karrtikr karrtikr added verification-needed Verification of issue is requested and removed verification-steps-needed Steps to verify are needed for verification labels Aug 20, 2021
@rzhao271 rzhao271 added the verified Verification succeeded label Aug 24, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing bug Issue identified by VS Code Team member as probable bug verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants