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

Support different options for discovering and running tests with pytest #15148

Closed
rompe opened this issue Jan 14, 2021 · 3 comments
Closed

Support different options for discovering and running tests with pytest #15148

rompe opened this issue Jan 14, 2021 · 3 comments
Labels
area-testing feature-request Request for new features or functionality

Comments

@rompe
Copy link

rompe commented Jan 14, 2021

I would like to use additional pytest options when running tests, but not when discovering tests.

Scenario

  1. I want to generate coverage data on every test run, so I have this in my settings.json:
    "python.testing.pytestArgs": [
        "src/unittests",
        "--cov=.",
        "--cov-report=xml:coverage.xml",
        "-vvv"
    ],
  1. But I don't want to generate coverage when debugging a test, so I disable it in my launch.json:
        {
            "name": "Debug Tests",
            "type": "python",
            "request": "test",
            "console": "integratedTerminal",
            "env": {"PYTEST_ADDOPTS": "--no-cov"},
            "justMyCode": false
        }
  1. I also don't want coverage data when tests are discovered because discovery is way faster without these options. This seems to be impossible at the moment.

What I need

I think I need either a possibility to inject the --no-cov option somewhere around

pytestargs.insert(0, "--collect-only")
or I need a possibility to just add the coverage options for non-debug test runs only.

@rompe rompe added triage-needed Needs assignment to the proper sub-team feature-request Request for new features or functionality labels Jan 14, 2021
@karthiknadig karthiknadig added area-testing needs decision and removed triage-needed Needs assignment to the proper sub-team labels Jan 14, 2021
@karthiknadig
Copy link
Member

Thank you for the suggestion! We have marked this issue as "needs decision" to make sure we have a conversation about your idea. We plan to leave this feature request open for at least a month to see how many 👍 votes the opening comment gets to help us make our decision.

@luabud luabud added needs spike Label for issues that need investigation before they can be worked on. and removed needs decision labels Mar 10, 2021
@eleanorjboyd
Copy link
Member

same as #21255, closing this to move all discussion to that issue. Thanks!

@eleanorjboyd eleanorjboyd closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2023
@github-actions github-actions bot removed the needs spike Label for issues that need investigation before they can be worked on. label Jul 26, 2023
@eleanorjboyd
Copy link
Member

I created a proposal with a solution for this problem, would love your input on the above issue! #21845

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

4 participants