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

The "-m" option is ignored in python.testing.pytestArgs #10827

Closed
chrisroat opened this issue Mar 27, 2020 · 3 comments
Closed

The "-m" option is ignored in python.testing.pytestArgs #10827

chrisroat opened this issue Mar 27, 2020 · 3 comments
Labels
area-testing bug Issue identified by VS Code Team member as probable bug

Comments

@chrisroat
Copy link

Environment data

  • VS Code version: 1.43.2
  • Extension version (available under the Extensions sidebar): 2020.3.69010
  • OS and version: MacOS 10.15.2
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.5
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pipenv
  • Relevant/affected Python packages and their versions: pytest 5.4.1
  • Relevant/affected Python-related VS Code extensions and their versions: N/A
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): Jedi enabled
  • Value of the python.languageServer setting: Microsoft

Expected behaviour

> ~/.local/share/virtualenvs/<venv>/bin/python -m pytest --rootdir <dir> --junitxml=/tmp/tmp-5194MFThkjpdZCwl.xml  -m "not slow" <testfile>

Actual behaviour

> ~/.local/share/virtualenvs/<venv>/bin/python -m pytest --rootdir <dir> --junitxml=/tmp/tmp-5194MFThkjpdZCwl.xml <testfile>

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Use the following settings for pytestArgs:
    "python.testing.pytestArgs": [
        "-m",
        "not slow"
    ],
  1. Run a test via the Test UI panel on the left hand side.

I did try combining the options onto one line with "-m\"not slow\"" (which works when running via command-line), but in that case pytest did not seem to pick it up properly.

@chrisroat chrisroat added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Mar 27, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Mar 30, 2020
@karrtikr karrtikr assigned karrtikr and unassigned karrtikr Mar 31, 2020
@karrtikr
Copy link

I can reproduce this issue when running tests files, suites, classes, methods, but not when I Run all tests either using the UI or the command. I see the following in that case.

~\AppData\Local\Programs\Python\Python37\python.exe -m pytest --rootdir <dir> --junitxml=C:\Users\<user>\AppData\Local\Temp\tmp-104720ScIOFoOCTat.xml -m "not slow"

But this is still a bug, thanks for reporting.

@karrtikr karrtikr removed the triage label Mar 31, 2020
@karrtikr karrtikr removed their assignment Mar 31, 2020
@github-actions github-actions bot removed the needs PR label Aug 9, 2022
@karrtikr karrtikr added the needs PR Ready to be worked on label Aug 9, 2022
@iam-decoder
Copy link

Was able to fix this in my vscode by making the mark arg a single line:

{
    "python.testing.pytestArgs": [
        "-m not slow",
        "--cov-report=lcov:.coverage.lcov"
    ],
}

@eleanorjboyd
Copy link
Member

Hello! We have just finished our testing rewrite and are beginning the rollout to users. I have tested this issue with the re-write and I am no longer reproducing the bug! If you would like to try it yourself, you need to add this setting to your users settings.json "python.experiments.optInto": ["pythonTestAdapter"]. Let me know if it doesn’t work for you and we can re-open this issue. Thanks!

@github-actions github-actions bot removed the needs PR Ready to be worked on label Jul 14, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2023
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
Projects
None yet
Development

No branches or pull requests

5 participants