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

Pytest Arg --slow not working #23838

Closed
timothy-glover opened this issue Jul 19, 2024 · 4 comments
Closed

Pytest Arg --slow not working #23838

timothy-glover opened this issue Jul 19, 2024 · 4 comments
Assignees
Labels
area-testing triage-needed Needs assignment to the proper sub-team

Comments

@timothy-glover
Copy link

Type: Bug

Behaviour

When specifying "python.testing.pytestArgs": ["--slow"] in the settings.json file, the argument is not passed to pytest when running as all tests marked as slow are not run.

A way around this which works as expected is to specifiy the following in a pytest.ini file:
addopts = --slow

Steps to reproduce:

This requires pytest-skip-slow to be installed: https://pypi.org/project/pytest-skip-slow/

  1. Create unit test marked with @pytest.mark.slow to cause it to only run when --slow is passed to the pytest command.
  2. Add "python.testing.pytestArgs": ["--slow"] to the settings.json file.
  3. Attempt to run the test in testing tab or otherwise.
  4. Observe that the test is skipped

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2024-07-19 11:32:13.159 [warning] could not find a pixi interpreter for the interpreter at C:\Users\XXXX\AppData\Local\Programs\Python\Python311\python.exe
2024-07-19 11:32:13.248 [warning] could not find a pixi interpreter for the interpreter at C:\Users\XXXX\AppData\Local\Programs\Python\Python311\python.exe
2024-07-19 11:32:13.260 [info] > ~\AppData\Local\Programs\Python\Python311\python.exe -m pytest --rootdir . --override-ini junit_family=xunit1 --junit-xml=~\AppData\Local\Temp\tmp-21632hlr2Q4W7zdbA.xml ./XXXXXX/XXXXXX/XXXXXX/test_XXXXXX.py::test_XXXXXX[XXXXXXTest]
2024-07-19 11:32:13.260 [info] cwd: .

Extension version: 2024.10.0
VS Code version: Code 1.91.1 (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:06:49.809Z)
OS version: Windows_NT x64 10.0.19045
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.11.3
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
  • Value of the python.languageServer setting: Default
User Settings


pixiToolPath: "<placeholder>"

languageServer: "Pylance"

testing
• pytestEnabled: true

Installed Extensions
Extension Name Extension Id Version
JavaScript Debugger ms-vscode.js-debug 1.91.0
JavaScript Debugger Companion Extension ms-vscode.js-debug-companion 1.1.2
Jupyter ms-toolsai.jupyter 2024.6.0
Jupyter Cell Tags ms-toolsai.vscode-jupyter-cell-tags 0.1.9
Jupyter Keymap ms-toolsai.jupyter-keymap 1.1.2
Jupyter Notebook Renderers ms-toolsai.jupyter-renderers 1.0.18
Jupyter Slide Show ms-toolsai.vscode-jupyter-slideshow 0.1.6
Pylance ms-python.vscode-pylance 2024.7.1
Python ms-python.python 2024.10.0
Python Debugger ms-python.debugpy 2024.8.0
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.9
System Info
Item Value
CPUs Intel(R) Core(TM) i5-4460 CPU @ 3.20GHz (4 x 3193)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 15.87GB (3.76GB free)
Process Argv
Screen Reader no
VM 0%
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jul 19, 2024
@karthiknadig karthiknadig changed the title Pytest Arg --slow not working Pytest Arg --slow not working Jul 22, 2024
@eleanorjboyd
Copy link
Member

Hello! Looks like you are on the pre-rewrite code for our testing update. Please opt in and this should fix your issue! You can do so by adding this to your user settings "python.experiments.optOutFrom": ["pythonTestAdapter"],. then check your logs because these aren't included --override-ini junit_family=xunit1 --junit-xml as args unless your specifically added them.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Jul 22, 2024
@timothy-glover
Copy link
Author

Hi. Thanks for getting back to me.

I tried your suggestion to no avail but I am assuming you mean to suggest that I use "python.experiments.optInto": ["pythonTestAdapter"],, which does seem to have an impact. After adding the opt in option and adding --override-ini junit_family=xunit1 --junit-xml to the args as well, I am now getting a test discovery error for my project. The error line is below.

TypeError: HookimplMarker.__call__() got an unexpected keyword argument 'wrapper'

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Jul 23, 2024
@eleanorjboyd
Copy link
Member

Hi! No need to add --override-ini junit_family=xunit1 --junit-xml, I was only asking if you had already had those arguments listed but hearing your response they are the ones we injected. To get around that error you will just need to update pluggy to a version higher than 1.1.0. It comes with pytest and the 1.1.0 is a pulled version due to this wrapper issue

@timothy-glover
Copy link
Author

Thanks again for the response. This has Indeed solved the problem.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants