question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test discovery can't add two subdirectories with a third different directory (Multiple raw data nodes had the same id)

See original GitHub issue

Issue Type: Bug

Behaviour

Expected vs. Actual

Expected: Discover all tests Actual: Only 1 test folder discovered, with an error

Steps to reproduce:

  1. Create a Python project with tests in two subdirectories (let’s say services/service_a/ and services/service_b/, and a third test in a completely different directory (libs/)
  2. Add the 3 directories as arguments to python.testing.pytestArgs
  3. Enable testing using pytest and run test discovery
  4. Only one test directory from services/ will be shown in the Testing sidebar.

This is basically the same as #17825 , I’ve updated their minimal repro: https://github.com/Avasam/pytest-example cant_discover

Settings

  "python.testing.pytestEnabled": true,
  "python.testing.pytestArgs": [
    "backend/services/admin-service/tests",
    "backend/services/auth-service/tests",
    "backend/services/collect-service/tests",
    "backend/services/data-service/tests",
    "backend/services/documents-service/tests",
    "backend/services/email-service/tests",
    "backend/services/messaging-service/tests",
    "backend/services/platform-service/tests",
    "backend/services/public-service/tests",
    "backend/services/search-service/tests",
    "backend/libs/utils/tests"
  ],

Logs

> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear backend/services/auth-service/tests
cwd: .
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear backend/services/admin-service/tests
cwd: .
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear backend/services/documents-service/tests
cwd: .
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear backend/services/email-service/tests
cwd: .
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear backend/services/collect-service/tests
cwd: .
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear backend/services/messaging-service/tests
cwd: .
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear backend/services/data-service/tests
cwd: .
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear backend/services/public-service/tests
cwd: .
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear backend/services/platform-service/tests
cwd: .
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear backend/services/search-service/tests
cwd: .
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear backend/libs/utils/tests
cwd: .
[ERROR 2022-3-1 10:15:17.404]: Multiple (10) raw data nodes had the same id: ./backend/services

Diagnostic data

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


defaultLS: {"defaultLSType":"Pylance"}

downloadLanguageServer: true

envFile: "<placeholder>"

venvPath: "<placeholder>"

venvFolders: "<placeholder>"

condaPath: "<placeholder>"

pipenvPath: "<placeholder>"

poetryPath: "<placeholder>"

languageServer: "Pylance"

linting
• enabled: true
• cwd: "<placeholder>"
• Flake8Args: "<placeholder>"
• flake8Enabled: true
• flake8Path: "<placeholder>"
• lintOnSave: true
• banditArgs: "<placeholder>"
• banditEnabled: true
• banditPath: "<placeholder>"
• mypyArgs: "<placeholder>"
• mypyEnabled: false
• mypyPath: "<placeholder>"
• pycodestyleArgs: "<placeholder>"
• pycodestyleEnabled: false
• pycodestylePath: "<placeholder>"
• prospectorArgs: "<placeholder>"
• prospectorEnabled: false
• prospectorPath: "<placeholder>"
• pydocstyleArgs: "<placeholder>"
• pydocstyleEnabled: false
• pydocstylePath: "<placeholder>"
• pylamaArgs: "<placeholder>"
• pylamaEnabled: false
• pylamaPath: "<placeholder>"
• pylintArgs: "<placeholder>"
• pylintPath: "<placeholder>"

sortImports
• args: "<placeholder>"
• path: "<placeholder>"

formatting
• autopep8Args: "<placeholder>"
• autopep8Path: "<placeholder>"
• provider: "black"
• blackArgs: "<placeholder>"
• blackPath: "<placeholder>"
• yapfArgs: "<placeholder>"
• yapfPath: "<placeholder>"

testing
• cwd: "<placeholder>"
• debugPort: 3000
• nosetestArgs: "<placeholder>"
• nosetestsEnabled: undefined
• nosetestPath: "<placeholder>"
• promptToConfigure: true
• pytestArgs: "<placeholder>"
• pytestEnabled: true
• pytestPath: "<placeholder>"
• unittestArgs: "<placeholder>"
• unittestEnabled: false
• autoTestDiscoverOnSaveEnabled: true

terminal
• activateEnvironment: true
• executeInFileDir: "<placeholder>"
• launchArgs: "<placeholder>"

experiments
• enabled: true
• optInto: []
• optOutFrom: []

tensorBoard
• logDirectory: "<placeholder>"

Extension version: 2022.4.0 VS Code version: Code 1.65.2 (c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1, 2022-03-10T14:33:55.248Z) OS version: Windows_NT x64 10.0.22000 Restricted Mode: No

System Info
Item Value
CPUs 11th Gen Intel® Core™ i7-11800H @ 2.30GHz (16 x 2304)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.73GB (13.91GB free)
Process Argv –crash-reporter-id 4445ba58-d44c-466c-98f0-5bd849375fe8
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30443607
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscoreces:30445986
pythondataviewer:30285071
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vsclayoutctrt:30451275
dsvsc009:30452663
pythonvsnew555:30457759
vscscmwlcmt:30438805
pynewfile477:30463512

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
Avasamcommented, Apr 8, 2022

Hi @Avasam, thank you for reaching out.

Does pytest discovery work when you run it directly in the terminal? python -m pytest --rootdir . -s --cache-clear backend/libs/utils/tests?

Hi, sorry for the late answer. I’ll base my answer on the minimal repro I made, since that’s something everyone can see and base themselves of. Running any of the following (individually or sequentially) does not throw:

@REM Running tests
python -m pytest --rootdir . -s --cache-clear tests/services/service_a
python -m pytest --rootdir . -s --cache-clear tests/services/service_b
python -m pytest --rootdir . -s --cache-clear tests/libs/utils

@REM Running the same discovery command as VSCode
py  C:\Users\Avasam\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear tests/services/service_a
py  C:\Users\Avasam\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear tests/services/service_b
py  C:\Users\Avasam\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear tests/libs/utils

VSCode’s Python output:

> "C:\Program Files\Python39\python.exe" ~\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear tests/services/service_a
cwd: .
> "C:\Program Files\Python39\python.exe" ~\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear tests/services/service_b
cwd: .
> "C:\Program Files\Python39\python.exe" ~\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear tests/libs/utils
cwd: .
[ERROR 2022-3-8 11:44:29.682]: Multiple (3) raw data nodes had the same id: ./tests
[ERROR 2022-3-8 11:44:30.878]: Multiple (2) raw data nodes had the same id: ./tests/services
0reactions
kimadelinecommented, May 3, 2022

Make sure that the work done in #17242 addresses this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSCode pytest test discovery fails - python - Stack Overflow
From the command line I'm just doing pytest tests from within the same virtual env that VS Code is using. – devlife. Apr...
Read more >
Using an Oracle database as a source for AWS DMS
If no primary key exists and the table has multiple unique indexes, AWS DMS selects the first unique index in an alphabetically ordered...
Read more >
Manipulating, analyzing and exporting data with tidyverse
Add new columns to a data frame that are functions of existing columns with mutate . Use the split-apply-combine concept for data analysis....
Read more >
Volumes | Kubernetes
A Docker volume is a directory on disk or in another container. ... Volumes cannot mount within other volumes (but see Using subPath...
Read more >
Apache HBase ™ Reference Guide
In a distributed configuration, the cluster contains multiple nodes, each of which runs one or more HBase daemon. These include primary and backup...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found