Skip to content
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

Error: Test result not found when using parameterized fixtures #17079

Closed
dasturge opened this issue Aug 23, 2021 · 6 comments · Fixed by #17086
Closed

Error: Test result not found when using parameterized fixtures #17079

dasturge opened this issue Aug 23, 2021 · 6 comments · Fixed by #17086
Assignees
Labels
area-testing bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release

Comments

@dasturge
Copy link

Environment data

  • VS Code version: 1.59.0
  • Extension version (available under the Extensions sidebar): v2021.9.1137256656-dev
  • OS and version: Ubuntu 18.04
  • Python version (& distribution if applicable, e.g. Anaconda): python 3.8.10, conda 4.10.3
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions: pytest 6.2.4
  • Relevant/affected Python-related VS Code extensions and their versions: Python (version above)
  • Value of the python.languageServer setting: Pylance

[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

I'm using a parameterized fixture for my package, which runs tests against a group of valid configuration files

# tests/conftest.py
import pytest
import yaml

approved_config_list = [
    "experiments/config.yml",
    "experiments/model_v1.0.yml",
]

@pytest.fixture(params=approved_config_list)
def config(request):
    with open(request.param) as fd:
        cfg = yaml.safe_load(fd)
    return cfg

Actual behaviour

All of my tests are passing, however, for each parameterized test I get something like:

Test result not found for: ./tests/test_postprocessing.py::TestPostprocessing::test_input_type[experiments/config.yml]

If I remove the parameterization here then the testing sidebar finds all of the test results just fine and confirms they all succeeded. The test log output also has no issues and says everything passed.

Steps to reproduce:

I think writing some simple pytests with these files should reproduce this and also use the same characters in the params in case it's a special character issue.

# tests/conftest.py
import pytest
import yaml

approved_config_list = [
    "experiments/config.yml",
    "experiments/model_v1.0.yml",
]

@pytest.fixture(params=approved_config_list)
def config(request):
    with open(request.param) as fd:
        cfg = yaml.safe_load(fd)
    return cfg
# tests/test_file.py

class TestConfig:
    def test_config(self, config):
        assert isinstance(config, dict)
# experiments/config.yml
attr1: 1
attr2: 2

# experments/model_v1.0.yml
attr1: 1
attr2: 3
# .vscode/launch.json
{
    "python.testing.pytestEnabled": true,
    "python.testing.pytestArgs": [
        "tests"
    ],
}
@dasturge dasturge added bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team labels Aug 23, 2021
@dasturge
Copy link
Author

I think I have found the issue, it is the forward slash character in the params

@karthiknadig karthiknadig self-assigned this Aug 24, 2021
@karthiknadig karthiknadig added area-testing needs PR regression Bug didn't exist in a previous release and removed triage-needed Needs assignment to the proper sub-team labels Aug 24, 2021
@karthiknadig
Copy link
Member

@jzazo
Copy link

jzazo commented Sep 7, 2021

I am experiencing a similar issue in all my tests, being them parametrized with fixtures or not. I have my repo divided in multiple workspaces, so I am not sure this issue might be related to that.

@karthiknadig
Copy link
Member

@jzazo Can you file a separate bug and provide repro details?

@jzazo
Copy link

jzazo commented Sep 9, 2021

I have created the following issue with repro details: #17343
Thanks.

@zaccharieramzi
Copy link

zaccharieramzi commented Nov 22, 2021

@karthiknadig I am still experiencing this issue. I don't have any slashed in my params.
Do you want a reproducible example?

My last update is apparently (but not sure how to really check it): 04/11/2021, 19:40:15. Is it enough to have the fix to this problem?

EDIT

Sorry about that, this was just a VSCode version problem

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 23, 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 regression Bug didn't exist in a previous release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants