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

function in parameter in parameterized test cause test to be skipped with 'ERROR: Not found' message. #24912

Open
PrzemyslawLukasik opened this issue Mar 18, 2025 · 1 comment
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@PrzemyslawLukasik
Copy link

PrzemyslawLukasik commented Mar 18, 2025

Type: Bug

Behaviour

Test with a function in the parameter (input parameter in this case) causes test to be skipped with the message:

ERROR: not found: /Users/przemekl/tmp/interview/openx/test_substring.py::test_invalid_substring[DdbrDiwhdn]
(no match in any of [<Module test_substring.py>])

Steps to reproduce:

  1. function find_substring raises ValuError if input string length i 0 or bigger than 1024
  2. function gen_str(n) returns string with n-number of characters
  3. parametrized tests that verifies if a ValueError is rised:
    @pytest.mark.parametrize("inp", [
    (""),
    (f"{get_str(10)}")
    ])
    def test_invalid_substring(inp) -> None:
        with pytest.raises(ValueError):
            find_substrings(inp)
Image

executted from cli:

Image

Diagnostic data

``` 2025-03-18 09:10:18.708 [info] Discover tests for workspace name: openx - uri: /Users/przemekl/tmp/interview/openx 2025-03-18 09:10:18.714 [info] arg: --rootdir already exists in args, not adding. 2025-03-18 09:10:18.714 [info] All environment variables set for pytest discovery, PYTHONPATH: "/Users/przemekl/.vscode/extensions/ms-python.python-2025.2.0-darwin-arm64/python_files" 2025-03-18 09:10:18.717 [info] > ./.venv/bin/python -m pytest -p vscode_pytest --collect-only --rootdir=. 2025-03-18 09:10:18.717 [info] cwd: . 2025-03-18 09:10:18.908 [info] ============================= test session starts ==============================

2025-03-18 09:10:18.908 [info] platform darwin -- Python 3.12.9, pytest-8.3.5, pluggy-1.5.0

2025-03-18 09:10:18.909 [info] rootdir: /Users/przemekl/tmp/interview/openx
configfile: pyproject.toml

2025-03-18 09:10:18.911 [info] collected 2 items

2025-03-18 09:10:18.911 [info]

2025-03-18 09:10:18.912 [info]

2025-03-18 09:10:18.912 [info] ========================== 2 tests collected in 0.00s ==========================

2025-03-18 09:10:20.664 [info] arg: --rootdir already exists in args, not adding.
2025-03-18 09:10:20.665 [info] Attempting to use temp directory for test ids file, file name: test-ids-a2abf64184c60d4c7a21.txt
2025-03-18 09:10:20.668 [info] All environment variables set for pytest execution, PYTHONPATH: "/Users/przemekl/.vscode/extensions/ms-python.python-2025.2.0-darwin-arm64/python_files"
2025-03-18 09:10:20.668 [info] Running pytest with arguments: /Users/przemekl/.vscode/extensions/ms-python.python-2025.2.0-darwin-arm64/python_files/vscode_pytest/run_pytest_script.py --rootdir=/Users/przemekl/tmp/interview/openx for workspace /Users/przemekl/tmp/interview/openx

2025-03-18 09:10:20.668 [info] > ./.venv/bin/python ~/.vscode/extensions/ms-python.python-2025.2.0-darwin-arm64/python_files/vscode_pytest/run_pytest_script.py --rootdir=.
2025-03-18 09:10:20.668 [info] cwd: .
2025-03-18 09:10:20.866 [error] Test Results named pipe /var/folders/q0/0phts9vd25z7s5k7kmq20qzm0000gn/T/python-test-results-2217f2645cd571722487 error: [TypeError: Cannot convert undefined or null to object
at Function.keys ()
at t.PythonResultResolver._resolveExecution (/Users/przemekl/.vscode/extensions/ms-python.python-2025.2.0-darwin-arm64/out/client/extension.js:2:917078)
at t.PythonResultResolver.resolveExecution (/Users/przemekl/.vscode/extensions/ms-python.python-2025.2.0-darwin-arm64/out/client/extension.js:2:916387)
at /Users/przemekl/.vscode/extensions/ms-python.python-2025.2.0-darwin-arm64/out/client/extension.js:2:960049
at b.callback (/Users/przemekl/.vscode/extensions/ms-python.python-2025.2.0-darwin-arm64/out/client/extension.js:2:930145)
at Object.thunk (/Users/przemekl/.vscode/extensions/ms-python.python-2025.2.0-darwin-arm64/out/client/extension.js:2:1994360)]
2025-03-18 09:10:20.883 [info] Test Result named pipe /var/folders/q0/0phts9vd25z7s5k7kmq20qzm0000gn/T/python-test-results-2217f2645cd571722487 cancelled

<summary>Output for <code>Python</code> in the <code>Output</code> panel (<code>View</code>→<code>Output</code>, change the drop-down the upper-right of the <code>Output</code> panel to <code>Python</code>)
</summary>

<p>
No test is run if parameterized test is triggered from test explorer.
If you try to run tets separately then test with empty string passess, and the one with generated string is skipped with the response below (generatred string reduced to 10 characters tor testing)

If tests are triggered from CLI, everything works properly.

Running pytest with args: ['-p', 'vscode_pytest', '--rootdir=/Users/przemekl/tmp/interview/openx', '/Users/przemekl/tmp/interview/openx/test_substring.py::test_invalid_substring[]', '/Users/przemekl/tmp/interview/openx/test_substring.py::test_invalid_substring[gKmSDbxzEB]']
============================= test session starts ==============================
platform darwin -- Python 3.12.9, pytest-8.3.5, pluggy-1.5.0
rootdir: /Users/przemekl/tmp/interview/openx
configfile: pyproject.toml
collected 1 item

============================ no tests ran in 0.00s =============================
ERROR: not found: /Users/przemekl/tmp/interview/openx/test_substring.py::test_invalid_substring[gKmSDbxzEB]
(no match in any of [])

Finished running tests!


</p>
</details>


Extension version: 2025.2.0
VS Code version: Code 1.98.2 (Universal) (ddc367ed5c8936efe395cffeec279b04ffd7db78, 2025-03-12T13:32:45.399Z)
OS version: Darwin arm64 24.3.0
Modes:

-   Python version (& distribution if applicable, e.g. Anaconda): 3.12.9
-   Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Poetry
-   Value of the `python.languageServer` setting: Pylance

<details>
<summary>User Settings</summary>
<p>

venvPath: ""

venvFolders: ""

languageServer: "Pylance"

testing
• cwd: ""
• promptToConfigure: false
• pytestArgs: ""
• pytestEnabled: true
• pytestPath: ""

</p>
</details>

<details>
<summary>Installed Extensions</summary>

|Extension Name|Extension Id|Version|
|---|---|---|
|debugpy|ms-|2025.5.2025031101|
|flake8|ms-|2025.2.0|
|jupyter|ms-|2025.2.0|
|jupyter-renderers|ms-|1.1.0|
|pylint|ms-|2025.2.0|
|python|ms-|2025.2.0|
|python-venv-switcher|wmi|0.4.1|
|robotcode|d-b|1.0.3|
|vscode-pylance|ms-|2025.3.2|
</details>
<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Apple M2 Pro (12 x 2400)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: enabled<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled<br>webnn: disabled_off|
|Load (avg)|2, 2, 3|
|Memory (System)|32.00GB (3.10GB free)|
|Process Argv|--crash-reporter-id 4d17580d-92b7-4ce3-bd44-ee6c08aea19e|
|Screen Reader|no|
|VM|0%|
</details><details>
<summary>A/B Experiments</summary>

vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
py29gd2263:31024239
vscaac:30438847
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dwnewjupyter:31046869
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc2:31192216
iacca1:31171482
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
5a9hg449:31230677
hdaa2157:31222309
copilot_t_ci:31222730
968h8231:31259996
jda6j935:31233686
fh1c7952:31258891
4gafe986:31257590
31787653:31256342


</details>

<!-- generated by issue reporter -->
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Mar 18, 2025
@PrzemyslawLukasik PrzemyslawLukasik changed the title function in parameter in parameterized test cause cause test to be skipped with 'ERROR: Not found' message. function in parameter in parameterized test cause test to be skipped with 'ERROR: Not found' message. Mar 18, 2025
@eleanorjboyd
Copy link
Member

will investigate- thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants