question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test result not found for with pytest on remote wsl

See original GitHub issue

Environment data

  • VS Code version: 1.60
  • Extension version (available under the Extensions sidebar): v2021.9.1191016588
  • OS and version: windows 10 1909 & wsl2 ubuntu20.04
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.8.10
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv
  • Relevant/affected Python packages and their versions: pytest-6.2.5
  • Relevant/affected Python-related VS Code extensions and their versions: Pylance v2021.9.0
  • Value of the python.languageServer setting: Default

[NOTE: If you suspect that your issue is related to the Microsoft Python Language Server (python.languageServer: 'Microsoft'), please download our new language server Pylance from the VS Code marketplace to see if that fixes your issue]

Expected behaviour

This simple test should appear succeeded in UI :

def test_passing():
   assert 42 == 42

Actual behaviour

The test is failed (red circle) with this reason :

Test result not found for: ./tests/pytest/pytest_test.py::test_passing

Code_HOhNdGBisX

note: in output > Python Test Log, the test is passed

Steps to reproduce:

Follow those steps : https://github.com/microsoft/vscode-python/issues/16963#issuecomment-902860825 with or without the activation of the insider channel activation.

Logs

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

Python interpreter path: ./venv/bin/python
> ~/git/netbox-caas/venv/bin/python -m pytest --rootdir ~/git/netbox-caas --override-ini junit_family=xunit1 --junit-xml=/tmp/tmp-2817iJ4TjLoT6PC5.xml ./tests/pytest/pytest_test.py::test_passing
cwd: ~/git/netbox-caas

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

============================= test session starts ==============================
platform linux -- Python 3.8.10, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /home/gcgg7847/git/netbox-caas
plugins: Faker-8.12.0
collected 1 item

tests/pytest/pytest_test.py .                                            [100%]

-------------- generated xml file: /tmp/tmp-2817vwk6JDLT2v9d.xml ---------------
============================== 1 passed in 0.06s ===============================

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
karthiknadigcommented, Sep 4, 2021

@sthiriet Sorry I wasn’t clear with the title. The problem was any file or folder starting with py. The test runner and test discovery use different mechanisms to identify tests for running and identifying results (we are addressing this in the current milestone https://github.com/microsoft/vscode-python/issues/17242).

0reactions
cbernard-pseecommented, Sep 8, 2021

facing also the same issue in WSL environment, test explorer tab is not able to extract the results. I cannot apply the proposed workaround ( renaming test directory from “tests” to “pytest” ) . @karthiknadig : Do you know when #17242 is planned to be released?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test result not found for with pytest on remote wsl #17270
Actual behaviour. The test is failed (red circle) with this reason : Test result not found for: ./tests/pytest/pytest_test ...
Read more >
Can't get remote wsl interpreter to work with pytest
Whenever I try to run a test via pytest in pycharm 2020.2 using an interpreter in WSL, I get a file not found...
Read more >
VSCode does not detect any of my pytest tests - Stack Overflow
Install the 'Remote - WSL' VSCode extension; Open a new WSL Window in VSCode; Install Anaconda in Ubuntu using this guide; Install the...
Read more >
Testing Python in Visual Studio Code
When you enable a test framework, VS Code prompts you to install the framework package if it's not already present in the currently...
Read more >
VS Code Debugger not working for python - Microsoft Q&A
The Python extension is broken - just seems to have updated at the same time as VS Code. Go back to extension version...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found