Skip to content

Test discovery doesn't work into container #21637

Description

Hi there, I used devcontainer for my work but I cannot now, I can discover the tests, but I cannot run it because of incorrect path (as I can assume because debug setup with full path from launch.json works fine)

I am using following setting for my devcontainer:

"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [
    "-c",
    "Tests/pytest.docker-compose.ini",
    "Tests"
]

but as I can see while I am trying to run test path starts from one folder inside and not tests folder, for example:
unit/test_third_api.py
while it should be:
Tests/unit/test_third_api.py
because path is incorrect I see Error: ERROR: file or directory not found: integration/...

Since I am using devcontainer top level folder was app previously, not it is one level into it not app but Tests

Also color indication does not work at all I mean it does not representing any info, not green check marks nor red crosses

OS: ubuntu 22.04
vscode: 1.80.0

Temporary solution: change extension version from 2023.12.0 to 2023.8.0 works fine for me

Activity

  1. eleanorjboyd commented on Jul 17, 2023

    @eleanorjboyd
    Member

    Thank you for your issue report. We are looking into this now! In the meantime, you are likely on the new testing rewrite and this is why you saw a change in behavior since we just moved to this experiment to a larger group of people receiving it. You can opt out of the rewrite as I get this fix in by setting this in your user settings: "python.experiments.optOutFrom": ["pythonTestAdapter"],. If this doesn't work let me know as this will mean it is a different issue. Thank you and I will send updates in this thread as I get a fix in.

  2. akarev0 commented on Jul 17, 2023

    @akarev0
    Author

    Eleanor Boyd (@eleanorjboyd)
    unfortunately, this also does not work for me, tried following settings:

    "python.experiments.optInto": [
            "pythonTestAdapter"
        ],
    "python.experiments.enabled": false,
    

    without any visual success

    If I am using just

    "python.experiments.optInto": [
            "pythonTestAdapter"
        ]
    

    nothing changed, issue is the same

    I am using 2023.8.0 extension version as a temporary solution. 2023.12.0 not 2023.10.1 does not work for me

  3. eleanorjboyd commented on Jul 17, 2023

    @eleanorjboyd
    Member

    Yevhen Dmytrenko (@akarev0) just to confirm did you try to set this setting in your user settings not your workspace settings? Seeing a few people presenting similar errors and opting out of the experiment was a solution for them. Just trying to determine if these issues are the same or different. Thanks for your help and quick replies!

  4. akarev0 commented on Jul 18, 2023

    @akarev0
    Author

    Eleanor Boyd (@eleanorjboyd) yes, I am sure that I am using user settings, but I just understood that they doesn't make any sense because I am using devcontainer which is remote workspace and those settings doesn't work. They are inactive according to color schema

  5. eleanorjboyd commented on Jul 20, 2023

    @eleanorjboyd
    Member

    partially impacted by pytest-dev/pytest#11235, but will also look at what else is breaking since I think there are multiple issues

  6. added
    bugIssue identified by VS Code Team member as probable bug
    and removed
    feature-requestRequest for new features or functionality
    on Aug 3, 2023
  7. akarev0 commented on Aug 4, 2023

    @akarev0
    Author

    recently released python 2023.14.0 doesn't fix anything(

  8. akarev0 commented on Aug 4, 2023

    @akarev0
    Author

    Eleanor Boyd (@eleanorjboyd) I don't know if it matters but I am using some custom things like:

    • pytest_plugins into highest level like Tests/conftest.py to load some fixtures
    • at the same file I am also using pytest_addoption it looks like
    def pytest_addoption(parser):
            parser.addoption("--replay_test_dir", action="store")
            parser.addoption("--replay_test_manifest", action="store")
    
    • also I am using addopts into my pytest.ini

    Hope that it will help you guys to figure out where is the bug

  9. eleanorjboyd commented on Aug 4, 2023

    @eleanorjboyd
    Member

    Hi! We had to roll back this fix due to a bug so the fix is not out in the most recent release. Hopefully we will get it out soon and then you can test it from there. Thanks!

  10. tekumara commented on Aug 21, 2023

    @tekumara

    FYI - also seeing this when using remote SSH.

    v2023.14.0

  11. eleanorjboyd commented on Aug 21, 2023

    @eleanorjboyd
    Member

    Oliver Mannion (@tekumara) are you seeing this on insiders? The fix is out there but not on stable.

  12. github-actions commented on Sep 21, 2023

    @github-actions

    Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.

    Happy Coding!

  13. locked as resolved and limited conversation to collaborators on Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-testingbugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from postertriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions