Open mayrholu opened 1 year ago
Same problem here
On my side, some are fine; some do not show the state after the run.
I was not able to easily reproduce this. Any code/repo example to share?
@mayrholu Does <path>
s that you've hidden look good to you? Does your working directory set to the path to the project?
@kondratyev-nv it happens to me directly with: https://github.com/oxsecurity/megalinter
@bdovaz Thanks! I see most tests do not get the right test state in this repo. This is due to tests being defined in the parent class (LinterTestRoot) and the extension not being able to resolve the right test ID. Other tests (e.g., config_test) seems to be working fine for me.
@MichalMazurek @mayrholu Are you using parent classes for tests as well?
Sorry for the late reply!
For me it happens even in the super simple case here:
Project folder with only one file:
./tests/test_pytest.py
Content:
def test_pytest_1():
assert True
def test_pytest_2():
assert False
@kondratyev-nv I'm experiencing this problem too. If I run my pytest unit tests in Test Explorer in VS Code, they "flash blue", then the icons are grayed out again. If I then look at Output->Python Test Adaptor Log
, then the Running pytest with arguments:
line, copy the arguments, remove the commas, then run the result in the Bash terminal, the tests run successfully.
Note that both successful and failed test results are not displayed; everything is just "gray" after the tests are run.
@kondratyev-nv is there any additional output/info I can provide you with or test something to get this issue resolved?
I have the same issue, any suggesting?
I had the same problem, caused by the matchParentPath
function failing on the unusual path ../../../../../<path>/test/test_treeview_tests.py
produced by pytest. It seemed to be caused by the combination of the absolute rootpath
passed to pytest and the fact that my workspace path contained a symlink. Opening the workspace by its true path fixed the problem for me.
@Zetaeta Do you mean you opened the workspace in VS Code without the symlink? We do have a symlink in our path.
I'll try opening the workspace tomorrow via the non-symlink path, and report back.
@rcartmil Yes, I opened the workspace by navigating to the original non-symlinked path and everything started working (including the built in python test explorer, which not working was what caused me to install this extension in the first place).
@Zetaeta Wow, you are amazing! This solved my problem too! You've certainly made my day!
And just to be clear, both the original "Test Explorer" and this Python Test Adapter's "Test Explorer" are working now, same as you.
Hi there, while the workaround is great, it’s not a longtime solution for the problem. Is there any plans on fixing this? Or any hints on where to look for the problem so I can give it a try?
When using pytest the icons in the test explorer remain gray (no matter if tests fail or pass).
The output shows the following (I had to mask actual paths and names):
When I click on "Debug this test" the following output is shown in debug terminal:
Python version is 3.11.0 (also reproducable with 3.10.4 and 3.8.3). Python Test Explorer version is 0.7.1 Running VSCode 1.74.0 on Linux (SuSE SLE15)
No problems when switching to unittest, however most of our test suite is designed for pytest. Any help would be appreciated!