Skip to content

ERROR: Test not found; the issue occurs with a test that uses random data in pytest.mark.parametrize. #22526

@a-kachurin

Description

@a-kachurin

Type: Bug

Behaviour

Expected vs. Actual

Expected:
Clicking on test in TEST EXPLORER bar, test successfully started

Actual:
Clicking on test in TEST EXPLORER bar, getting: ERROR: not found: test_example.py::TestExample::test_1[sTlq]
(no name in any of [])

Steps to reproduce:

  1. Add test:
import random
import string

import pytest


def gen_data():
    return ''.join(random.choices(string.ascii_letters, k=4))


@pytest.fixture()
def return_data(request):
    return {"test": request.param[0]}


class TestExample:
    @pytest.mark.parametrize(
        "return_data",
        [
            (
                (gen_data())
            )
        ],
        indirect=["return_data"])
    def test_1(self, return_data):
        print(return_data)

image

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.11.6
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2023-11-25 07:35:07.435 [info] Experiment 'All' is active
2023-11-25 07:35:07.435 [info] Default formatter is set to null for workspace c:\Users\alexk\Documents\example
2023-11-25 07:35:07.435 [info] Test server listening.
2023-11-25 07:35:07.435 [info] Python interpreter path: c:\program files\python311\python.exe
2023-11-25 07:35:08.532 [info] Starting Pylance language server.
2023-11-25 07:35:16.525 [info] Discover tests for workspace name: example - uri: c:\Users\alexk\Documents\example
2023-11-25 07:35:16.525 [info] Running discovery for pytest using the new test adapter.
2023-11-25 07:35:16.525 [info] All environment variables set for pytest discovery for workspace c:\Users\alexk\Documents\example: {"ALLUSERSPROFILE":"C:\\ProgramData","APPDATA":"C:\\Users\\alexk\\AppData\\Roaming","APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL":"1","CHROME_CRASHPAD_PIPE_NAME":"\\\\.\\pipe\\crashpad_16532_QWCKZXEBYYBPXLLL","COMPUTERNAME":"K_PC","CONAN_USER_HOME":"F:\\","ELECTRON_RUN_AS_NODE":"1","HOMEDRIVE":"C:","HOMEPATH":"\\Users\\alexk","IGCCSVC_DB":"AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA0NINSWi79ke+RjQoUv4UmAQAAAACAAAAAAAQZgAAAAEAACAAAAC4OdZGKVMbGx1YgwYLf+BVD0eKGtLp1BEMLWXbhYhUHgAAAAAOgAAAAAIAACAAAAC7qigYDqbvJeuNHgKIZqW6mEb0qXC16EymRy4lr3SzQGAAAABLERGwxq7GhZuqlNzuQcqx1SpCPxJ8uPNQ3CZKy9RRJThZX/+q/Xh/8VwGbyD4UlPBPDxQ8Ou79yg7EQt53g2BV/jcVaOJjvr4EnhyT/8SyacARIOOX8EaQsA343gujsZAAAAAvWWVBsM9o3tTp1ZUw+OqJFIS9H9mcffXs8mP/bYthWWeUm9vyj2nBwPyWNTI94EYm4T0EQdgij3lbYC4vvX0nQ==","LOCALAPPDATA":"C:\\Users\\alexk\\AppData\\Local","LOGONSERVER":"\\\\K_PC","NUMBER_OF_PROCESSORS":"24","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","OS":"Windows_NT","PATHEXT":".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW","PROCESSOR_ARCHITECTURE":"AMD64","PROCESSOR_IDENTIFIER":"Intel64 Family 6 Model 183 Stepping 1, GenuineIntel","PROCESSOR_LEVEL":"6","PROCESSOR_REVISION":"b701","PUBLIC":"C:\\Users\\Public","TEMP":"C:\\Users\\alexk\\AppData\\Local\\Temp","TMP":"C:\\Users\\alexk\\AppData\\Local\\Temp","USERDOMAIN":"K_PC","USERDOMAIN_ROAMINGPROFILE":"K_PC","USERNAME":"alexk","USERPROFILE":"C:\\Users\\alexk","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CODE_CACHE_PATH":"C:\\Users\\alexk\\AppData\\Roaming\\Code\\CachedData\\1a5daa3a0231a0fbba4f14db7ec463cf99d7768e","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"C:\\Program Files\\Microsoft VS Code","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"\\\\.\\pipe\\b1993ca3248d0b964d73e5c114b33e56-1.84.2-main-sock","VSCODE_NLS_CONFIG":"{\"locale\":\"en\",\"osLocale\":\"ru\",\"availableLanguages\":{},\"_languagePackSupport\":true}","VSCODE_PID":"16532","VSLANG":"1033","ZES_ENABLE_SYSMAN":"1","ComSpec":"C:\\Windows\\system32\\cmd.exe","CommonProgramFiles":"C:\\Program Files\\Common Files","CommonProgramFiles(x86)":"C:\\Program Files (x86)\\Common Files","CommonProgramW6432":"C:\\Program Files\\Common Files","DriverData":"C:\\Windows\\System32\\Drivers\\DriverData","OneDrive":"C:\\Users\\alexk\\OneDrive","PSModulePath":"C:\\Program Files (x86)\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files (x86)\\AutoIt3\\AutoItX","ProgramData":"C:\\ProgramData","ProgramFiles":"C:\\Program Files","ProgramFiles(x86)":"C:\\Program Files (x86)","ProgramW6432":"C:\\Program Files","SystemDrive":"C:","SystemRoot":"C:\\Windows","__PSLockDownPolicy":"0","windir":"C:\\Windows","Path":"c:\\program files\\python311\\scripts\\;c:\\program files\\python311\\;C:\\Program Files\\Python310\\Scripts\\;C:\\Program Files\\Python310\\;c:\\program files\\conan\\conan;c:\\program files\\python27;c:\\windows\\system32;c:\\windows;c:\\windows\\system32\\wbem;c:\\windows\\system32\\windowspowershell\\v1.0\\;c:\\windows\\system32\\openssh\\;c:\\program files\\git\\cmd;c:\\program files\\dotnet\\;c:\\program files\\google\\chrome\\application;c:\\program files\\nvidia corporation\\nvidia nvdlisr;c:\\program files\\nodejs\\;c:\\program files\\microsoft vs code\\bin;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Program Files\\CMake\\bin;C:\\Users\\alexk\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\alexk\\AppData\\Roaming\\npm;C:\\Users\\alexk\\.dotnet\\tools;","PYTHONPATH":"c:\\Users\\alexk\\.vscode\\extensions\\ms-python.python-2023.21.13261010\\pythonFiles","TEST_UUID":"e83b228a-21e8-4e17-8956-4bfc19f961b8","TEST_PORT":"63397"} 

2023-11-25 07:35:16.539 [info] > "c:\program files\python311\python.exe" -m pytest -p vscode_pytest --collect-only
2023-11-25 07:35:16.539 [info] cwd: .
2023-11-25 07:35:16.984 [info] ============================= test session starts =============================
platform win32 -- Python 3.11.6, pytest-7.4.3, pluggy-1.3.0

2023-11-25 07:35:16.986 [info] rootdir: c:\Users\alexk\Documents\example
plugins: Faker-20.0.3, cov-4.1.0, repeat-0.9.3, xdist-3.4.0, testit-adapter-pytest-2.4.1

2023-11-25 07:35:16.990 [info] collected 1 item

<Module test_example.py>
  <Class TestExample>
    <Function test_1[zWpK]>

2023-11-25 07:35:16.992 [info] Test server connected to a client.
2023-11-25 07:35:16.993 [info] ResultResolver EOT received for discovery.
2023-11-25 07:35:16.994 [info] 
========================== 1 test collected in 0.01s ==========================

2023-11-25 07:35:17.022 [info] Disposing data receiver for c:\Users\alexk\Documents\example and deleting UUID; pytest discovery.
2023-11-25 07:35:20.782 [info] Server listening on port 63468
2023-11-25 07:35:20.785 [info] All environment variables set for pytest execution in c:\Users\alexk\Documents\example workspace: 
 {"ALLUSERSPROFILE":"C:\\ProgramData","APPDATA":"C:\\Users\\alexk\\AppData\\Roaming","APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL":"1","CHROME_CRASHPAD_PIPE_NAME":"\\\\.\\pipe\\crashpad_16532_QWCKZXEBYYBPXLLL","COMPUTERNAME":"K_PC","CONAN_USER_HOME":"F:\\","ELECTRON_RUN_AS_NODE":"1","HOMEDRIVE":"C:","HOMEPATH":"\\Users\\alexk","IGCCSVC_DB":"AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA0NINSWi79ke+RjQoUv4UmAQAAAACAAAAAAAQZgAAAAEAACAAAAC4OdZGKVMbGx1YgwYLf+BVD0eKGtLp1BEMLWXbhYhUHgAAAAAOgAAAAAIAACAAAAC7qigYDqbvJeuNHgKIZqW6mEb0qXC16EymRy4lr3SzQGAAAABLERGwxq7GhZuqlNzuQcqx1SpCPxJ8uPNQ3CZKy9RRJThZX/+q/Xh/8VwGbyD4UlPBPDxQ8Ou79yg7EQt53g2BV/jcVaOJjvr4EnhyT/8SyacARIOOX8EaQsA343gujsZAAAAAvWWVBsM9o3tTp1ZUw+OqJFIS9H9mcffXs8mP/bYthWWeUm9vyj2nBwPyWNTI94EYm4T0EQdgij3lbYC4vvX0nQ==","LOCALAPPDATA":"C:\\Users\\alexk\\AppData\\Local","LOGONSERVER":"\\\\K_PC","NUMBER_OF_PROCESSORS":"24","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","OS":"Windows_NT","PATHEXT":".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW","PROCESSOR_ARCHITECTURE":"AMD64","PROCESSOR_IDENTIFIER":"Intel64 Family 6 Model 183 Stepping 1, GenuineIntel","PROCESSOR_LEVEL":"6","PROCESSOR_REVISION":"b701","PUBLIC":"C:\\Users\\Public","TEMP":"C:\\Users\\alexk\\AppData\\Local\\Temp","TMP":"C:\\Users\\alexk\\AppData\\Local\\Temp","USERDOMAIN":"K_PC","USERDOMAIN_ROAMINGPROFILE":"K_PC","USERNAME":"alexk","USERPROFILE":"C:\\Users\\alexk","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CODE_CACHE_PATH":"C:\\Users\\alexk\\AppData\\Roaming\\Code\\CachedData\\1a5daa3a0231a0fbba4f14db7ec463cf99d7768e","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"C:\\Program Files\\Microsoft VS Code","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"\\\\.\\pipe\\b1993ca3248d0b964d73e5c114b33e56-1.84.2-main-sock","VSCODE_NLS_CONFIG":"{\"locale\":\"en\",\"osLocale\":\"ru\",\"availableLanguages\":{},\"_languagePackSupport\":true}","VSCODE_PID":"16532","VSLANG":"1033","ZES_ENABLE_SYSMAN":"1","ComSpec":"C:\\Windows\\system32\\cmd.exe","CommonProgramFiles":"C:\\Program Files\\Common Files","CommonProgramFiles(x86)":"C:\\Program Files (x86)\\Common Files","CommonProgramW6432":"C:\\Program Files\\Common Files","DriverData":"C:\\Windows\\System32\\Drivers\\DriverData","OneDrive":"C:\\Users\\alexk\\OneDrive","PSModulePath":"C:\\Program Files (x86)\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files (x86)\\AutoIt3\\AutoItX","ProgramData":"C:\\ProgramData","ProgramFiles":"C:\\Program Files","ProgramFiles(x86)":"C:\\Program Files (x86)","ProgramW6432":"C:\\Program Files","SystemDrive":"C:","SystemRoot":"C:\\Windows","__PSLockDownPolicy":"0","windir":"C:\\Windows","Path":"c:\\program files\\python311\\scripts\\;c:\\program files\\python311\\;C:\\Program Files\\Python310\\Scripts\\;C:\\Program Files\\Python310\\;c:\\program files\\conan\\conan;c:\\program files\\python27;c:\\windows\\system32;c:\\windows;c:\\windows\\system32\\wbem;c:\\windows\\system32\\windowspowershell\\v1.0\\;c:\\windows\\system32\\openssh\\;c:\\program files\\git\\cmd;c:\\program files\\dotnet\\;c:\\program files\\google\\chrome\\application;c:\\program files\\nvidia corporation\\nvidia nvdlisr;c:\\program files\\nodejs\\;c:\\program files\\microsoft vs code\\bin;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Program Files\\CMake\\bin;C:\\Users\\alexk\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\alexk\\AppData\\Roaming\\npm;C:\\Users\\alexk\\.dotnet\\tools;","PYTHONPATH":"c:\\Users\\alexk\\.vscode\\extensions\\ms-python.python-2023.21.13261010\\pythonFiles","TEST_UUID":"a30fe1c6-53e7-47d5-8838-d08951d79742","TEST_PORT":"63397","RUN_TEST_IDS_PORT":"63468"}
2023-11-25 07:35:20.785 [info] Running pytest with arguments: c:\Users\alexk\.vscode\extensions\ms-python.python-2023.21.13261010\pythonFiles\vscode_pytest\run_pytest_script.py --rootdir c:\Users\alexk\Documents\example for workspace c:\Users\alexk\Documents\example 

2023-11-25 07:35:20.785 [info] > "c:\program files\python311\python.exe" ~\.vscode\extensions\ms-python.python-2023.21.13261010\pythonFiles\vscode_pytest\run_pytest_script.py --rootdir .
2023-11-25 07:35:20.785 [info] cwd: .
2023-11-25 07:35:21.234 [info] Test server connected to a client.
2023-11-25 07:35:21.235 [info] ResultResolver EOT received for execution.
2023-11-25 07:35:21.242 [info] Client disconnected
2023-11-25 07:35:21.264 [info] Disposing data receiver for c:\Users\alexk\Documents\example and deleting UUID; pytest execution.

User Settings


languageServer: "Pylance"

testing
• pytestEnabled: true

experiments
• optInto: ["All"]

Extension version: 2023.21.13261010
VS Code version: Code 1.84.2 (1a5daa3a0231a0fbba4f14db7ec463cf99d7768e, 2023-11-09T10:51:52.184Z)
OS version: Windows_NT x64 10.0.22621
Modes:

System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i7-13700K (24 x 3418)
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 63.76GB (51.87GB free)
Process Argv --crash-reporter-id 2b5a0ed1-4981-4290-911b-a9374f02c7db
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263:30880072
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
282f8724:30602487
f6dab269:30613381
2i9eh265:30646982
showlangstatbar:30737416
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
welcomedialog:30887143
pythonnosmt12:30797651
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
dsvsc013:30795093
dsvsc014:30804076
dsvsc015:30845448
pythontestfixtcf:30871695
pythonregdiag2:30871582
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:30885898
pythontbext0:30879054
dsvsc016cf:30886111
dsvsc017cf:30886113
dsvsc018cf:30886115
aa_t_chat:30882232

Metadata

Metadata

Assignees

Labels

area-testinginfo-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