kondratyev-nv / vscode-python-test-adapter

Python Test Adapter for the VS Code Test Explorer
https://marketplace.visualstudio.com/items?itemName=LittleFoxTeam.vscode-python-test-adapter
MIT License
117 stars 27 forks source link

Tests do not run #232

Closed etothepii closed 3 years ago

etothepii commented 3 years ago

I have a couple of tests set up using pytest.

image

When I click play they go blue with the elipsis

image

But then return.

This appears to be happening on both my and my co-founders computers across multiple projects and appears to have started occurring sometime during last night (everything was working at 2000 GMT on Tuesday 16th March.

I can't see that a new version has been released, but as it is happening on multiple computers across multiple projects I assume something external has changed.

setting.json looks like:

{
    "python.pythonPath": "SOME_CONDA_ENVIROMENT",
    "python.testing.pytestArgs": [
        "remove-white-background"
    ],
    "python.testing.unittestEnabled": false,
    "python.testing.nosetestsEnabled": false,
    "python.testing.pytestEnabled": true
}

The python test adapter log appears free of errors:

2021-03-17T11:34:37.107Z INFO pytest at 'project-name': Reading configuration for workspace project-name
2021-03-17T11:34:37.108Z  DBG pytest at 'project-name': usingNewInterpreterStorage feature flag is 'true'
2021-03-17T11:34:37.108Z INFO pytest at 'project-name': Using auto-detected pythonPath SOME_CONDA_ENVIROMENT
2021-03-17T11:34:37.109Z INFO pytest at 'project-name': Running tests using python path 'SOME_CONDA_ENVIROMENT' in PROJECT_FOLDER
2021-03-17T11:34:37.109Z INFO pytest at 'project-name': Environment variables file PROJECT_FOLDER/.env does not exist
2021-03-17T11:34:37.113Z INFO pytest at 'project-name': Running pytest with arguments: --rootdir=PROJECT_FOLDER, --junitxml=/var/folders/kk/m58vb4996x10jnrg4n7kcchc0000gn/T/tmp-1272-buZvkt6qIWZI, --override-ini, junit_logging=all, --override-ini, junit_family=xunit1, folder-name
2021-03-17T11:34:37.113Z INFO pytest at 'project-name': Running pytest as a Python module
2021-03-17T11:34:42.571Z INFO pytest at 'project-name': Test execution completed

The tests run correctly with pytest .

Update

Errors can be caused to appear on uncompilable code.

image

voidz0r commented 3 years ago

I'm having the same error since the last VSCode update, looks like an integration issue. My tests are executing correctly with pytest cli

Keyeoh commented 3 years ago

Another one here with the same error.

image

image

image

image

BrendanSimon commented 3 years ago

Yep. Seeing the same thing. I downgraded to vscode 1.53 and things are working again. Same thing happens with Insdiers build too.

I did notice that the standard vscode testing tree works ok.

image

ws1088 commented 3 years ago

I spent the last 3 hours trying to figure out the same issue. Looks like if the test is in the same directory as the workspace then the test will run, all other tests will turn "blue" and then "grey", same as all reporters above. I am using 1.55 and insider with this issue. I remember last time I used 1.53 and it is working well. FYI

SophiaZ12 commented 3 years ago

I have the same issue. I noticed that it works with Unittest and the problem only occurs with Pytest.

etothepii commented 3 years ago

I have confirmed that regressing to v1.53.2 solves the problem, unfortunately VSCode is a little "upgrade happy" so will likely upgrade me and break again.

kondratyev-nv commented 3 years ago

Sorry for the wait 😥 I can confirm the issue. Will try to fix it today.

etothepii commented 3 years ago

No need to apologise! A short term work around has been identified.

pauloapi commented 3 years ago

Thank you for working hard @kondratyev-nv <3

kondratyev-nv commented 3 years ago

I've published a new version 0.6.7. Please, update and let me know if the issue persists.

BrendanSimon commented 3 years ago

Works for me now on Win10 Pro, for both Insiders and Stable (V1.54.3).

Version: 1.54.3 (user setup)
Commit: 2b9aebd5354a3629c3aba0a5f5df49f43d6689f8
Date: 2021-03-15T10:55:45.459Z
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.19042
ws1088 commented 3 years ago

thanks, works for me as well. thanks again!

Keyeoh commented 3 years ago

image

It's great to see all this green again! :)

Thanks a lot @kondratyev-nv for your great work!

farfalk commented 3 years ago

I'm still having this issue in vscode 1.56.2 running in WSLv1(Ubuntu 20.04.2 LTS), with extension version 0.6.8, using pytest 5.4.3. All tests turn blue and seemingly run, but they all turn grey at the end.

Tests work correctly in python extension test module and from terminal, as in above comments.

Sorry to reopen this :(

kondratyev-nv commented 3 years ago

@farfalk I think this is might be another issue. Can you please post it as a new issue and add some more details, like testing framework (maybe plugins), some output from CLI run, and whether there are any weird messages in Python Test Adapter logs.

farfalk commented 2 years ago

@farfalk I think this is might be another issue. Can you please post it as a new issue and add some more details, like testing framework (maybe plugins), some output from CLI run, and whether there are any weird messages in Python Test Adapter logs.

Sorry for the extremely late response, I missed the notification. I tested it again today after more than a month, and reproduced the issue with vscode 1.58.2. BUT I SOLVED IT, doing what follows:

  1. deleted the .pytest_cache folder in root folder
  2. deleted the __pycache__ folder in the test folder
  3. closed the vscode editor without doing anything else
  4. reopened the vscode editor
  5. ran the tests
  6. everything turned green :)

Since this, everything works without any issue. Reproduced the fix in all my existing projects, with multiple python versions.