forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
Type: Bug
Behaviour
Multiple tests are displayed by test explorer when we have test function with same name in two different test class and both the test function shares some common fixture.
Steps to reproduce:
- Create a new project and add the below provided code in a new test module.
- Observe the test explorer tree.
- Duplicates tests are observed for each test case.
import pytest
@pytest.fixture(scope="function", params=[1, 2])
def setup(request):
return request.param
class TestClass1:
def test_method1(self, setup):
assert 1 == 1
class TestClass2:
def test_method1(self, setup):
assert 2 == 2
Diagnostic data
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
2024-05-30 19:21:12.876 [info] Discover tests for workspace name: TestProject - uri: /Users/saurabhrai/AutomationProject/TestProject/tests/test_demo.py
2024-05-30 19:21:12.876 [info] Running discovery for pytest using the new test adapter.
2024-05-30 19:21:12.877 [info] All environment variables set for pytest discovery: {"COMMAND_MODE":"unix2003","HOME":"/Users/saurabhrai","JAVA_HOME":"/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home","LOGNAME":"saurabhrai","LaunchInstanceID":"5524BF1F-1C86-4267-9F65-5DF4B2AA5CBC","MallocNanoZone":"0","OLDPWD":"/","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","PWD":"/","SECURITYSESSIONID":"186a4","SHELL":"/bin/zsh","SHLVL":"0","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.ukoMt4j0XS/Listeners","TMPDIR":"/var/folders/vm/_sszf9116zzd84s_20byyyk00000gp/T/","USER":"saurabhrai","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CODE_CACHE_PATH":"/Users/saurabhrai/Library/Application Support/Code/CachedData/dc96b837cf6bb4af9cd736aa3af08cf8279f7685","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/Users/saurabhrai/Library/Application Support/Code/1.89-main.sock","VSCODE_NLS_CONFIG":"{\"locale\":\"en-gb\",\"osLocale\":\"en-in\",\"availableLanguages\":{},\"_languagePackSupport\":true}","VSCODE_PID":"597","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"application.com.microsoft.VSCode.74831843.74831849","_":"/Applications/Visual Studio Code.app/Contents/MacOS/Electron","__CFBundleIdentifier":"com.microsoft.VSCode","__CF_USER_TEXT_ENCODING":"0x1F6:0x0:0x0","ELECTRON_RUN_AS_NODE":"1","NODE_TLS_REJECT_UNAUTHORIZED":"0","PATH":"/Library/Frameworks/Python.framework/Versions/3.8/bin:/Users/saurabhrai/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/opt/apache-maven/bin:/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin","PYTHONPATH":"/Users/saurabhrai/.vscode/extensions/ms-python.python-2024.6.0/python_files","TEST_RUN_PIPE":"/var/folders/vm/_sszf9116zzd84s_20byyyk00000gp/T/python-test-discovery-4cf7184dd3ae031a7378.sock"}
2024-05-30 19:21:12.879 [info] > ~/Library/Caches/pypoetry/virtualenvs/unifiedapiframework-SVwGRVPg-py3.11/bin/python -m pytest -p vscode_pytest --collect-only .
2024-05-30 19:21:12.879 [info] cwd: .
2024-05-30 19:21:13.191 [info] ============================= test session starts ==============================
platform darwin -- Python 3.11.8, pytest-7.1.3, pluggy-1.0.0
2024-05-30 19:21:13.196 [info] rootdir: /Users/saurabhrai/AutomationProject/TestProject
plugins: rerunfailures-12.0, html-3.2.0, parallel-0.1.1, timeout-2.1.0, metadata-3.0.0, xdist-3.3.1, allure-pytest-2.13.2
2024-05-30 19:21:13.203 [info] collected 4 items
<Module tests/test_demo.py>
<Class TestClass1>
<Function test_method1[1]>
2024-05-30 19:21:13.203 [info]
<Class TestClass2>
<Function test_method1[1]>
<Class TestClass1>
<Function test_method1[2]>
<Class TestClass2>
<Function test_method1[2]>
2024-05-30 19:21:13.204 [info]
2024-05-30 19:21:13.205 [info] ========================== 4 tests collected in 0.01s ==========================
2024-05-30 19:21:33.113 [info] Discover tests for workspace name: TestProject - uri: /Users/saurabhrai/AutomationProject/TestProject/tests/test_demo.py
2024-05-30 19:21:33.114 [info] Running discovery for pytest using the new test adapter.
2024-05-30 19:21:33.115 [info] All environment variables set for pytest discovery: {"COMMAND_MODE":"unix2003","HOME":"/Users/saurabhrai","JAVA_HOME":"/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home","LOGNAME":"saurabhrai","LaunchInstanceID":"5524BF1F-1C86-4267-9F65-5DF4B2AA5CBC","MallocNanoZone":"0","OLDPWD":"/","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","PWD":"/","SECURITYSESSIONID":"186a4","SHELL":"/bin/zsh","SHLVL":"0","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.ukoMt4j0XS/Listeners","TMPDIR":"/var/folders/vm/_sszf9116zzd84s_20byyyk00000gp/T/","USER":"saurabhrai","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CODE_CACHE_PATH":"/Users/saurabhrai/Library/Application Support/Code/CachedData/dc96b837cf6bb4af9cd736aa3af08cf8279f7685","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/Users/saurabhrai/Library/Application Support/Code/1.89-main.sock","VSCODE_NLS_CONFIG":"{\"locale\":\"en-gb\",\"osLocale\":\"en-in\",\"availableLanguages\":{},\"_languagePackSupport\":true}","VSCODE_PID":"597","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"application.com.microsoft.VSCode.74831843.74831849","_":"/Applications/Visual Studio Code.app/Contents/MacOS/Electron","__CFBundleIdentifier":"com.microsoft.VSCode","__CF_USER_TEXT_ENCODING":"0x1F6:0x0:0x0","ELECTRON_RUN_AS_NODE":"1","NODE_TLS_REJECT_UNAUTHORIZED":"0","PATH":"/Library/Frameworks/Python.framework/Versions/3.8/bin:/Users/saurabhrai/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/opt/apache-maven/bin:/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin","PYTHONPATH":"/Users/saurabhrai/.vscode/extensions/ms-python.python-2024.6.0/python_files","TEST_RUN_PIPE":"/var/folders/vm/_sszf9116zzd84s_20byyyk00000gp/T/python-test-discovery-c930579b6bea281481ce.sock"}
2024-05-30 19:21:33.118 [info] > ~/Library/Caches/pypoetry/virtualenvs/unifiedapiframework-SVwGRVPg-py3.11/bin/python -m pytest -p vscode_pytest --collect-only .
2024-05-30 19:21:33.118 [info] cwd: .
2024-05-30 19:21:33.534 [info] ============================= test session starts ==============================
platform darwin -- Python 3.11.8, pytest-7.1.3, pluggy-1.0.0
2024-05-30 19:21:33.540 [info] rootdir: /Users/saurabhrai/AutomationProject/TestProject
plugins: rerunfailures-12.0, html-3.2.0, parallel-0.1.1, timeout-2.1.0, metadata-3.0.0, xdist-3.3.1, allure-pytest-2.13.2
2024-05-30 19:21:33.547 [info] collected 4 items
2024-05-30 19:21:33.547 [info] <Module tests/test_demo.py>
<Class TestClass1>
<Function test_method1[1]>
<Function test_method1[2]>
<Class TestClass2>
<Function test_method1[1]>
<Function test_method1[2]>
2024-05-30 19:21:33.549 [info]
========================== 4 tests collected in 0.01s ==========================
2024-05-30 19:21:51.150 [info] Discover tests for workspace name: TestProject - uri: /Users/saurabhrai/AutomationProject/TestProject
2024-05-30 19:21:51.150 [info] Running discovery for pytest using the new test adapter.
2024-05-30 19:21:51.151 [info] All environment variables set for pytest discovery: {"COMMAND_MODE":"unix2003","HOME":"/Users/saurabhrai","JAVA_HOME":"/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home","LOGNAME":"saurabhrai","LaunchInstanceID":"5524BF1F-1C86-4267-9F65-5DF4B2AA5CBC","MallocNanoZone":"0","OLDPWD":"/","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","PWD":"/","SECURITYSESSIONID":"186a4","SHELL":"/bin/zsh","SHLVL":"0","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.ukoMt4j0XS/Listeners","TMPDIR":"/var/folders/vm/_sszf9116zzd84s_20byyyk00000gp/T/","USER":"saurabhrai","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CODE_CACHE_PATH":"/Users/saurabhrai/Library/Application Support/Code/CachedData/dc96b837cf6bb4af9cd736aa3af08cf8279f7685","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/Users/saurabhrai/Library/Application Support/Code/1.89-main.sock","VSCODE_NLS_CONFIG":"{\"locale\":\"en-gb\",\"osLocale\":\"en-in\",\"availableLanguages\":{},\"_languagePackSupport\":true}","VSCODE_PID":"597","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"application.com.microsoft.VSCode.74831843.74831849","_":"/Applications/Visual Studio Code.app/Contents/MacOS/Electron","__CFBundleIdentifier":"com.microsoft.VSCode","__CF_USER_TEXT_ENCODING":"0x1F6:0x0:0x0","ELECTRON_RUN_AS_NODE":"1","NODE_TLS_REJECT_UNAUTHORIZED":"0","PATH":"/Library/Frameworks/Python.framework/Versions/3.8/bin:/Users/saurabhrai/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/opt/apache-maven/bin:/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin","PYTHONPATH":"/Users/saurabhrai/.vscode/extensions/ms-python.python-2024.6.0/python_files","TEST_RUN_PIPE":"/var/folders/vm/_sszf9116zzd84s_20byyyk00000gp/T/python-test-discovery-9dd008b5c74d773103e2.sock"}
2024-05-30 19:21:51.154 [info] > ~/Library/Caches/pypoetry/virtualenvs/unifiedapiframework-SVwGRVPg-py3.11/bin/python -m pytest -p vscode_pytest --collect-only .
2024-05-30 19:21:51.154 [info] cwd: .
2024-05-30 19:21:51.486 [info] ============================= test session starts ==============================
platform darwin -- Python 3.11.8, pytest-7.1.3, pluggy-1.0.0
2024-05-30 19:21:51.492 [info] rootdir: /Users/saurabhrai/AutomationProject/TestProject
plugins: rerunfailures-12.0, html-3.2.0, parallel-0.1.1, timeout-2.1.0, metadata-3.0.0, xdist-3.3.1, allure-pytest-2.13.2
2024-05-30 19:21:51.497 [info] collected 4 items
<Module tests/test_demo.py>
<Class TestClass1>
2024-05-30 19:21:51.497 [info] <Function test_method1[1]>
<Function test_method1[2]>
<Class TestClass2>
<Function test_method1[1]>
<Function test_method1[2]>
2024-05-30 19:21:51.499 [info]
========================== 4 tests collected in 0.01s ==========================
Extension version: 2024.6.0
VS Code version: Code 1.89.1 (Universal) (dc96b837cf6bb4af9cd736aa3af08cf8279f7685, 2024-05-07T05:14:24.611Z)
OS version: Darwin x64 23.4.0
Modes:
Connection to 'tunnel+ci-va2-remote' could not be established
Connection to 'tunnel+qaint-va2-remote' could not be established
- Python version (& distribution if applicable, e.g. Anaconda): 3.11.8
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Poetry
- Value of the
python.languageServer
setting: Default
User Settings
languageServer: "Pylance"
testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true
Installed Extensions
Extension Name | Extension Id | Version |
---|---|---|
Cobalt2 Theme Official | wesbos.theme-cobalt2 | 2.4.3 |
Code Spell Checker | streetsidesoftware.code-spell-checker | 3.0.1 |
Database Client | cweijan.vscode-database-client2 | 4.5.12 |
Database Client JDBC | cweijan.dbclient-jdbc | 1.3.5 |
Dev Containers | ms-vscode-remote.remote-containers | 0.362.0 |
Docker | ms-azuretools.vscode-docker | 1.29.1 |
Excel Viewer | GrapeCity.gc-excelviewer | 4.2.59 |
File Utils | sleistner.vscode-fileutils | 3.10.3 |
GitHub Copilot | GitHub.copilot | 1.197.0 |
GitHub Copilot Chat | GitHub.copilot-chat | 0.15.2 |
GitHub Pull Requests | GitHub.vscode-pull-request-github | 0.88.1 |
GitLens — Git supercharged | eamodio.gitlens | 15.0.4 |
JavaScript Debugger | ms-vscode.js-debug | 1.89.0 |
JavaScript Debugger Companion Extension | ms-vscode.js-debug-companion | 1.1.2 |
Jenkins Jack | saurabh.rai.jenkins-jack | 1.0.1 |
Jupyter | ms-toolsai.jupyter | 2024.4.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.17 |
Jupyter PowerToys | ms-toolsai.vscode-jupyter-powertoys | 0.1.1 |
Jupyter Slide Show | ms-toolsai.vscode-jupyter-slideshow | 0.1.6 |
Live Share | ms-vsliveshare.vsliveshare | 1.0.5918 |
Live Share Extension Pack | ms-vsliveshare.vsliveshare-pack | 0.4.0 |
Material Icon Theme | PKief.material-icon-theme | 5.3.0 |
Nasc VSCode Touchbar | felipe.nasc-touchbar | 1.12.0 |
Postman | Postman.postman-for-vscode | 1.0.3 |
Pylance | ms-python.vscode-pylance | 2024.5.1 |
Python | ms-python.python | 2024.6.0 |
Python Debugger | ms-python.debugpy | 2024.6.0 |
Rainbow CSV | mechatroner.rainbow-csv | 3.12.0 |
Remote - SSH | ms-vscode-remote.remote-ssh | 0.110.1 |
Remote - SSH: Editing Configuration Files | ms-vscode-remote.remote-ssh-edit | 0.86.0 |
Remote - Tunnels | ms-vscode.remote-server | 1.5.1 |
Remote Development | ms-vscode-remote.vscode-remote-extensionpack | 0.25.0 |
Remote Explorer | ms-vscode.remote-explorer | 0.4.3 |
Ruff | charliermarsh.ruff | 2024.22.0 |
SonarLint | SonarSource.sonarlint-vscode | 4.5.1 |
Table Visualizer for JavaScript Profiles | ms-vscode.vscode-js-profile-table | 1.0.9 |
Test Adapter Converter | ms-vscode.test-adapter-converter | 0.1.9 |
VS Code Speech | ms-vscode.vscode-speech | 0.8.0 |
vscode-icons | vscode-icons-team.vscode-icons | 12.7.0 |
YAML | redhat.vscode-yaml | 1.14.0 |
System Info
Item | Value |
---|---|
CPUs | Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off 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 webgl: enabled webgl2: enabled webgpu: enabled |
Load (avg) | 3, 4, 3 |
Memory (System) | 16.00GB (0.73GB free) |
Process Argv | --crash-reporter-id 4e1a7f74-58fc-4b9a-bed4-13f7d0786d16 |
Screen Reader | no |
VM | 0% |
Connection to 'tunnel+ci-va2-remote' could not be established
Connection to 'tunnel+qaint-va2-remote' could not be established
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscorecescf:30445987
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
vscrp:30673768
2i9eh265:30646982
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pythonmypyd1:30879173
pythoncet0:30885854
2e7ec940:31000449
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
showvideot:31016892
chatpanelc:31048052
dsvsc021:30996838
9c06g630:31013171
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecationcf:31061161
pythonprt:31056678
dwnewjupyter:31046869
26j00206:31048877