René's URL Explorer Experiment


Title: Debugging unittest tests silently reports "skipped" when `-s` points at a subdirectory · Issue #26155 · microsoft/vscode-python · GitHub

Open Graph Title: Debugging unittest tests silently reports "skipped" when `-s` points at a subdirectory · Issue #26155 · microsoft/vscode-python

X Title: Debugging unittest tests silently reports "skipped" when `-s` points at a subdirectory · Issue #26155 · microsoft/vscode-python

Description: Type: Bug (apologies if this should be in the debugger extenions issues, raising here as it appeared to originate in the python extensions code) Behaviour With python tests configured to use unittest and settings a custom --start-directo...

Open Graph Description: Type: Bug (apologies if this should be in the debugger extenions issues, raising here as it appeared to originate in the python extensions code) Behaviour With python tests configured to use unitte...

X Description: Type: Bug (apologies if this should be in the debugger extenions issues, raising here as it appeared to originate in the python extensions code) Behaviour With python tests configured to use unitte...

Opengraph URL: https://github.com/microsoft/vscode-python/issues/26155

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Debugging unittest tests silently reports \"skipped\" when `-s` points at a subdirectory","articleBody":"\nType: \u003cb>Bug\u003c/b>\n\n(apologies if this should be in the debugger extenions issues, raising here as it appeared to originate in the python extensions code)\n\n# Behaviour\n\nWith python tests configured to use unittest and settings a custom `--start-directory` set to a sub dir (rather than just `'.'`) I found that RUNNING tests from the GUI works fine, but DEBUGGING them does not. For the latter tests just report as skipped, and the results pannel reads \"The test case did not report any output.\". \n\nTest discovery itself is unaffected - the test tree is populated correctly & running tests works. It is only debug *execution* that fails.\n\nThe `Python` output channel shows the run path completing normally and the debug path\ntearing down its results pipe without ever receiving data:\n\n```\nRUN    12:04:20.034  Running unittest with arguments: ...execution.py --udiscovery -v -s ./test -p test_*.py\n       12:04:24.099  Test Result named pipe ...  received data          \u003c- works\n\nDEBUG  12:04:30.381  Running DEBUG unittest ...  execution.py,--udiscovery,-v,-s,./test,-p,test_*.py\n       12:04:40.428  [test-debug] Debug session started: Debug Tests: python (599b91eb...)\n       12:04:43.532  [test-debug] Debug session terminated: (599b91eb...)\n       12:04:43.532  Test Result named pipe ...  cancelled              \u003c- no data\n```\n\n## Steps to reproduce:\n\n1. A project whose tests live in an importable package below the workspace root, eg\n   `test/__init__.py`, `test/core/__init__.py`, `test/core/test_thing.py`.\n2. `.vscode/settings.json`:\n   ```json\n   {\n     \"python.testing.unittestEnabled\": true,\n     \"python.testing.pytestEnabled\": false,\n     \"python.testing.unittestArgs\": [\"-v\", \"-s\", \"./test\", \"-p\", \"test_*.py\"]\n   }\n   ```\n3. Discover tests, then pick any test and **Debug Test**.\n4. The test reports as \"skipped\"; no output anywhere. **Run Test** on the same test works.\n\nNot reproducible when `-s` is omitted or is `.`. My AI reckons this means #26033 may be related.\n\n## Workaround\n\nAdd `-t .` (aka `--top-level-directory .`) to `python.testing.unittestArgs` and refresh test discovery.\n\n```json\n\"python.testing.unittestArgs\": [\"-v\", \"-s\", \"./test\", \"-t\", \".\", \"-p\", \"test_*.py\"]\n```\n\n## AI identified potential cause & solution:\n\nI got my AI to poke around in order to find the workaround above, during which it believes it's identified the issue and a potential fix, i've included them in case they're useful. Apologies if they're just noise - it looks sensible to me but I'm not familiar enough with the details to know.\n\n\u003cdetails>\n\u003csummary>AI output\u003c/summary>\n\u003cp>\n\n### 1. The debug launch config never receives `PROJECT_ROOT_PATH`\n\nThe unittest **execution** adapter sets `PYTHONPATH`, `TEST_RUN_PIPE` and\n`PROJECT_ROOT_PATH` for the run path. The **debug** path, in `convertConfigToArgs`\n(inferred to be `src/client/testing/common/debugLauncher.ts`; quoted from the shipped\n`out/client/extension.js`, beautified), injects only two of them:\n\n```js\np.env = {\n  ...p.env,\n  TEST_RUN_PIPE: n.pytestPort,\n  RUN_TEST_IDS_PIPE: n.runTestIdsPort\n};\nconst d = u.join(h.EXTENSION_ROOT_DIR, \"python_files\");\nif (p.env) {\n  const e = [d];\n  p.cwd ? e.push(p.cwd) : n.cwd && e.push(n.cwd), (0, T.addPathToPythonpath)(e, p.env.PYTHONPATH)\n}\n```\n\nTwo defects here:\n\n* `PROJECT_ROOT_PATH` is never added.\n* `addPathToPythonpath(...)` is a pure function that *returns* the joined path, but its\n  return value is discarded, so `PYTHONPATH` is never set either.\n\nOnly the first causes the symptom reported here. `execution.py` inserts the resolved cwd\nonto `sys.path` itself (L213-217), so imports still resolve without `PYTHONPATH`.\n\nVerified by reading the resolved `LaunchRequest` from a debugpy log\n(`DEBUGPY_LOG_DIR`): the debuggee's `env` contains `RUN_TEST_IDS_PIPE` and\n`TEST_RUN_PIPE` but neither `PROJECT_ROOT_PATH` nor `PYTHONPATH`. Confirmed across\nthree separate debug sessions.\n\n### 2. Discovery and execution then disagree on `top_level_dir`\n\n`python_files/unittestadapter/discovery.py` (L144-150) overrides `top_level_dir` with\n`PROJECT_ROOT_PATH`:\n\n```python\nproject_root_path = os.environ.get(\"PROJECT_ROOT_PATH\")\nif project_root_path:\n    top_level_dir = project_root_path\n```\n\n`python_files/unittestadapter/execution.py` does not - it uses `-t` (default `None`, per\n`pvsc_utils.parse_unittest_args`) and additionally replaces `start_dir` with the resolved\ncwd:\n\n```python\ncwd = os.path.abspath(project_root_path or start_dir)\n...\nstart_dir = cwd\nsuite = loader.discover(start_dir, pattern, top_level_dir)\n```\n\nSo for `-s ./test` with no `-t`:\n\n| phase | `PROJECT_ROOT_PATH` | discovery root | resulting test id |\n|---|---|---|---|\n| discovery | set | workspace | `test.core.test_thing.TestThing.test_x` |\n| execution (run) | set | workspace | `test.core.test_thing.TestThing.test_x` |\n| execution (debug) | **absent** | `\u003cworkspace>/test` | `core.test_thing.TestThing.test_x` |\n\n### 3. A mismatch produces silence rather than an error\n\n`execution.py`'s `filter_tests` matches on exact `test.id()` strings, and results are\nstreamed per test via `UnittestTestResult` -> `send_run_data` -> `send_post_request`. An\nempty filtered suite therefore sends *nothing at all*, which is why the results pipe is\ncancelled with no data and the test renders as \"skipped\" rather than as an error.\n\n### 4. Why it is undiagnosable from the UI\n\nThe auto-generated test debug configuration resolves to `console: internalConsole` with\n`debugOptions: [\"Multiprocess\", \"FixFilePathCase\", \"ShowReturnValue\"]` and **no**\n`RedirectOutput`, so the adapter's stdout and stderr are discarded. Nothing appears in\nthe Debug Console, Terminal or Test Results. Adding `\"redirectOutput\": true` to a\n`launch.json` config with `\"purpose\": [\"debug-test\"]` restores output.\n\n\n## Suggested fix\n\n1. Propagate `PROJECT_ROOT_PATH` into the debug configuration's `env` alongside\n   `TEST_RUN_PIPE`/`RUN_TEST_IDS_PIPE`.\n2. Assign the result of `addPathToPythonpath(...)` back to `p.env.PYTHONPATH`.\n3. Consider having `execution.py` honour `PROJECT_ROOT_PATH` as `top_level_dir` the way\n   `discovery.py` does, so the two phases cannot disagree regardless of how the process\n   is launched.\n4. Consider defaulting `redirectOutput` to `true` for test debug sessions - the silence\n   is what made this expensive to diagnose.\n\nNote that (3) interacts with #26033, which is the opposite manifestation of the same\n`PROJECT_ROOT_PATH`/`-t` coupling introduced by #25780: there, `PROJECT_ROOT_PATH`\noverriding `-t` breaks discovery when the start directory is not importable from the\nworkspace root. A fix should probably reconcile both - honour an explicit `-t` when\ngiven, and otherwise apply `PROJECT_ROOT_PATH` consistently in *both* phases and *both*\nlaunch paths.\n\n\u003c/p>\n\u003c/details>\n\n## Application info:\n\nExtension version: 2026.4.0\nVS Code version: Code 1.113.0 (cfbea10c5ffb233ea9177d34726e6056e89913dc, 2026-03-24T15:07:18+01:00)\nOS version: Windows_NT x64 10.0.26100\n\n-   Python version: 3.13.11\n-   Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): venv\n-   Value of the `python.languageServer` setting: Default\n\n\u003cdetails>\n\u003csummary>User Settings\u003c/summary>\n\u003cp>\n\n```\n\nlanguageServer: \"Pylance\"\n\ntesting\n• unittestArgs: [\"-v\", \"-s\", \"./test\", \"-p\", \"test_*.py\"]\n• unittestEnabled: true\n\n```\n\u003c/p>\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>Installed Extensions\u003c/summary>\n\n|Extension Name|Extension Id|Version|\n|---|---|---|\n|cmake-tools|ms-|1.23.52|\n|code-spell-checker|str|4.5.6|\n|code-spell-checker-cspell-bundled-dictionaries|str|2.0.14|\n|cpp-devtools|ms-|0.5.13|\n|cpptools|ms-|1.32.2|\n|cpptools-extension-pack|ms-|1.5.1|\n|cpptools-themes|ms-|2.0.0|\n|debugpy|ms-|2026.6.0|\n|even-better-toml|tam|0.21.2|\n|js-debug|ms-|1.112.0|\n|js-debug-companion|ms-|1.1.3|\n|jupyter|ms-|2025.9.1|\n|jupyter-keymap|ms-|1.1.2|\n|jupyter-renderers|ms-|1.3.0|\n|markdown-mermaid|bie|1.32.1|\n|python|ms-|2026.4.0|\n|remote-explorer|ms-|0.5.0|\n|remote-ssh|ms-|0.124.0|\n|remote-ssh-edit|ms-|0.87.0|\n|ruff|cha|2026.60.0|\n|vscode-clangd|llv|0.6.0|\n|vscode-js-profile-table|ms-|1.0.10|\n|vscode-jupyter-cell-tags|ms-|0.1.9|\n|vscode-jupyter-slideshow|ms-|0.1.6|\n|vscode-pylance|ms-|2026.2.1|\n|vscode-python-envs|ms-|1.36.0|\n|vscode-xml|red|0.29.3|\n\u003c/details>\n\n\u003c!-- generated by issue reporter -->","author":{"url":"https://github.com/j-hil-nwm","@type":"Person","name":"j-hil-nwm"},"datePublished":"2026-09-17T13:56:38Z","url":"https://github.com/microsoft/vscode-python/issues/26155"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:6c14e6cf-c324-e243-b51c-cd20d58fe218
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idED1E:24F1E7:12598B:1ACAF2:6AFD70BB
html-safe-noncec33502790ad0cfb26754a92c4ff66007f225b3b93ca907214e37119091ea0609
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDFFOjI0RjFFNzoxMjU5OEI6MUFDQUYyOjZBRkQ3MEJCIiwidmlzaXRvcl9pZCI6IjY4NDcwMTA3NTU5NzIwMDE5NzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacc5563f0adea12b3c8d4db1c45dba30c98f67199519147866690a3d7428de3cc2
hovercard-subject-tagissue:5488339005
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/vscode-python/26155/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2c599829afc640d2b7b9b86f0e71a134747159c43b208e040c933f5243cf89ac/microsoft/vscode-python/issues/26155
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2c599829afc640d2b7b9b86f0e71a134747159c43b208e040c933f5243cf89ac/microsoft/vscode-python/issues/26155
og:image:altType: Bug (apologies if this should be in the debugger extenions issues, raising here as it appeared to originate in the python extensions code) Behaviour With python tests configured to use unitte...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamej-hil-nwm
hostnamegithub.com
expected-hostnamegithub.com
Nonee54006cf2b96d1ac260960edd10003132911469ccd1ec99c9803119fe2a4e032
turbo-cache-controlno-preview
go-importgithub.com/microsoft/vscode-python git https://github.com/microsoft/vscode-python.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id106462765
octolytics-dimension-repository_nwomicrosoft/vscode-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forktrue
octolytics-dimension-repository_parent_id49946255
octolytics-dimension-repository_parent_nwoDonJayamanne/pythonVSCode
octolytics-dimension-repository_network_root_id49946255
octolytics-dimension-repository_network_root_nwoDonJayamanne/pythonVSCode
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release5be0bf2b8cf26f8897d31e6bc3c232d328b12a54
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/vscode-python/issues/26155#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fvscode-python%2Fissues%2F26155
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fvscode-python%2Fissues%2F26155
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2Fvscode-python
Reloadhttps://github.com/microsoft/vscode-python/issues/26155
Reloadhttps://github.com/microsoft/vscode-python/issues/26155
Reloadhttps://github.com/microsoft/vscode-python/issues/26155
microsofthttps://github.com/microsoft
vscode-pythonhttps://github.com/microsoft/vscode-python
Codehttps://github.com/microsoft/vscode-python
Issues346 (346)https://github.com/microsoft/vscode-python/issues
Pull requests57 (57)https://github.com/microsoft/vscode-python/pulls
Discussionshttps://github.com/microsoft/vscode-python/discussions
Actionshttps://github.com/microsoft/vscode-python/actions
Wikihttps://github.com/microsoft/vscode-python/wiki
Security and quality2 (2)https://github.com/microsoft/vscode-python/security
Insightshttps://github.com/microsoft/vscode-python/insights
https://github.com/microsoft/vscode-python
New issuehttps://github.com/login?return_to=https://github.com/microsoft/vscode-python/issues/26155
New issuehttps://github.com/login?return_to=https://github.com/microsoft/vscode-python/issues/26155
#26230https://github.com/microsoft/vscode-python/pull/26230
Debugging unittest tests silently reports "skipped" when -s points at a subdirectoryhttps://github.com/microsoft/vscode-python/issues/26155#top
#26230https://github.com/microsoft/vscode-python/pull/26230
https://github.com/j-hil-nwm
j-hil-nwmhttps://github.com/j-hil-nwm
on Sep 17, 2026https://github.com/microsoft/vscode-python/issues/26155#issue-5488339005
#26033https://github.com/microsoft/vscode-python/issues/26033
#26033https://github.com/microsoft/vscode-python/issues/26033
#25780https://github.com/microsoft/vscode-python/pull/25780
github-actionshttps://github.com/apps/github-actions
triage-neededNeeds assignment to the proper sub-teamhttps://github.com/microsoft/vscode-python/issues?q=state%3Aopen%20label%3A%22triage-needed%22
on Sep 17, 2026https://github.com/microsoft/vscode-python/issues/26155#event-31324738791
vs-code-engineeringhttps://github.com/apps/vs-code-engineering
Eleanor Boyd (eleanorjboyd)https://github.com/eleanorjboyd
on Sep 17, 2026https://github.com/microsoft/vscode-python/issues/26155#event-31325510445
vs-code-engineeringhttps://github.com/apps/vs-code-engineering
triage-neededNeeds assignment to the proper sub-teamhttps://github.com/microsoft/vscode-python/issues?q=state%3Aopen%20label%3A%22triage-needed%22
on Sep 17, 2026https://github.com/microsoft/vscode-python/issues/26155#event-31325511294
Eduardo Villalpando Mello (edvilme)https://github.com/edvilme
Eleanor Boyd (eleanorjboyd)https://github.com/eleanorjboyd
on Nov 10, 2026https://github.com/microsoft/vscode-python/issues/26155#event-35741511983
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/vscode-python/issues/26155
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/vscode-python/issues/26155
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.