Skip to content

Commit bea589f

Browse files
authored
Merge branch 'main' into spontaneous-flea
2 parents 1a3dadd + 336d699 commit bea589f

File tree

17 files changed

+363
-138
lines changed

17 files changed

+363
-138
lines changed

build/azure-pipeline.stable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ extends:
128128
project: 'Monaco'
129129
definition: 593
130130
buildVersionToDownload: 'latestFromBranch'
131-
branchName: 'refs/heads/release/2025.16'
131+
branchName: 'refs/heads/release/2026.0'
132132
targetPath: '$(Build.SourcesDirectory)/python-env-tools/bin'
133133
artifactName: 'bin-$(buildTarget)'
134134
itemPattern: |

package-lock.json

Lines changed: 121 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "python",
33
"displayName": "Python",
44
"description": "Python language support with extension access points for IntelliSense (Pylance), Debugging (Python Debugger), linting, formatting, refactoring, unit tests, and more.",
5-
"version": "2025.21.0-dev",
5+
"version": "2026.1.0-dev",
66
"featureFlags": {
77
"usingNewInterpreterStorage": true
88
},

python_files/pythonrc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ def __str__(self):
7575

7676
return result
7777

78+
def __repr__(self):
79+
return "<Custom PS1 for VS Code Python Shell Integration>"
80+
7881

7982
if sys.platform != "win32" and (not is_wsl):
8083
sys.ps1 = PS1()

python_files/tests/pytestadapter/helpers.py

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -264,17 +264,34 @@ def runner_with_cwd_env(
264264
pipe_name = generate_random_pipe_name("pytest-discovery-test")
265265

266266
if "COVERAGE_ENABLED" in env_add and "_TEST_VAR_UNITTEST" not in env_add:
267-
process_args = [
268-
sys.executable,
269-
"-m",
270-
"pytest",
271-
"-p",
272-
"vscode_pytest",
273-
"--cov=.",
274-
"--cov-branch",
275-
"-s",
276-
*args,
277-
]
267+
if "_PYTEST_MANUAL_PLUGIN_LOAD" in env_add:
268+
# Test manual plugin loading scenario for issue #25590
269+
process_args = [
270+
sys.executable,
271+
"-m",
272+
"pytest",
273+
"--disable-plugin-autoload",
274+
"-p",
275+
"pytest_cov.plugin",
276+
"-p",
277+
"vscode_pytest",
278+
"--cov=.",
279+
"--cov-branch",
280+
"-s",
281+
*args,
282+
]
283+
else:
284+
process_args = [
285+
sys.executable,
286+
"-m",
287+
"pytest",
288+
"-p",
289+
"vscode_pytest",
290+
"--cov=.",
291+
"--cov-branch",
292+
"-s",
293+
*args,
294+
]
278295

279296
# Generate pipe name, pipe name specific per OS type.
280297

python_files/tests/pytestadapter/test_coverage.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,23 @@ def test_coverage_w_omit_config():
142142
assert results
143143
# assert one file is reported and one file (as specified in pyproject.toml) is omitted
144144
assert len(results) == 1
145+
146+
147+
def test_pytest_cov_manual_plugin_loading():
148+
"""
149+
Test that pytest-cov is detected when loaded manually via -p pytest_cov.plugin.
150+
151+
This test verifies the fix for issue #25590, where pytest-cov detection failed
152+
when using --disable-plugin-autoload with -p pytest_cov.plugin. The plugin is
153+
registered under its module name (pytest_cov.plugin) instead of entry point name
154+
(pytest_cov) in this scenario.
155+
"""
156+
args = ["--collect-only"]
157+
env_add = {"COVERAGE_ENABLED": "True", "_PYTEST_MANUAL_PLUGIN_LOAD": "True"}
158+
cov_folder_path = TEST_DATA_PATH / "coverage_gen"
159+
160+
# Should NOT raise VSCodePytestError about pytest-cov not being installed
161+
actual = runner_with_cwd_env(args, cov_folder_path, env_add)
162+
assert actual is not None
163+
# Verify discovery succeeded (status != "error")
164+
assert actual[0].get("status") != "error"

python_files/unittestadapter/execution.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -284,22 +284,21 @@ def send_run_data(raw_data, test_run_pipe):
284284
run_test_ids_pipe = os.environ.get("RUN_TEST_IDS_PIPE")
285285
test_run_pipe = os.getenv("TEST_RUN_PIPE")
286286
if not run_test_ids_pipe:
287-
print("Error[vscode-unittest]: RUN_TEST_IDS_PIPE env var is not set.")
287+
print("Error[vscode-unittest]: RUN_TEST_IDS_PIPE env var is not set.", file=sys.stderr)
288288
raise VSCodeUnittestError("Error[vscode-unittest]: RUN_TEST_IDS_PIPE env var is not set.")
289289
if not test_run_pipe:
290-
print("Error[vscode-unittest]: TEST_RUN_PIPE env var is not set.")
290+
print("Error[vscode-unittest]: TEST_RUN_PIPE env var is not set.", file=sys.stderr)
291291
raise VSCodeUnittestError("Error[vscode-unittest]: TEST_RUN_PIPE env var is not set.")
292292
test_ids = []
293293
cwd = pathlib.Path(start_dir).absolute()
294294
try:
295295
# Read the test ids from the file, attempt to delete file afterwords.
296296
ids_path = pathlib.Path(run_test_ids_pipe)
297297
test_ids = ids_path.read_text(encoding="utf-8").splitlines()
298-
print("Received test ids from temp file.")
299298
try:
300299
ids_path.unlink()
301300
except Exception as e:
302-
print("Error[vscode-pytest]: unable to delete temp file" + str(e))
301+
print(f"Error[vscode-unittest]: unable to delete temp file: {e}", file=sys.stderr)
303302

304303
except Exception as e:
305304
# No test ids received from buffer, return error payload
@@ -318,10 +317,6 @@ def send_run_data(raw_data, test_run_pipe):
318317
is_coverage_run = os.environ.get("COVERAGE_ENABLED") is not None
319318
include_branches = False
320319
if is_coverage_run:
321-
print(
322-
"COVERAGE_ENABLED env var set, starting coverage. workspace_root used as parent dir:",
323-
workspace_root,
324-
)
325320
import coverage
326321

327322
# insert "python_files/lib/python" into the path so packaging can be imported
@@ -350,7 +345,6 @@ def send_run_data(raw_data, test_run_pipe):
350345

351346
# If no error occurred, we will have test ids to run.
352347
if manage_py_path := os.environ.get("MANAGE_PY_PATH"):
353-
print("MANAGE_PY_PATH env var set, running Django test suite.")
354348
args = argv[index + 1 :] or []
355349
django_execution_runner(manage_py_path, test_ids, args)
356350
else:

python_files/vscode_pytest/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ def __init__(self, message):
8787

8888

8989
def pytest_load_initial_conftests(early_config, parser, args): # noqa: ARG001
90-
has_pytest_cov = early_config.pluginmanager.hasplugin("pytest_cov")
90+
has_pytest_cov = early_config.pluginmanager.hasplugin(
91+
"pytest_cov"
92+
) or early_config.pluginmanager.hasplugin("pytest_cov.plugin")
9193
has_cov_arg = any("--cov" in arg for arg in args)
9294
if has_cov_arg and not has_pytest_cov:
9395
raise VSCodePytestError(

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# This file was autogenerated by uv via the following command:
22
# uv pip compile --generate-hashes requirements.in -o requirements.txt
3-
importlib-metadata==8.7.0 \
4-
--hash=sha256:d13b81ad223b890aa16c5471f2ac3056cf76c5f10f82d6f9292f0b415f389000 \
5-
--hash=sha256:e5dd1551894c77868a30651cef00984d50e1002d06942a7101d34870c5f02afd
3+
importlib-metadata==8.7.1 \
4+
--hash=sha256:49fef1ae6440c182052f407c8d34a68f72efc36db9ca90dc0113398f2fdde8bb \
5+
--hash=sha256:5a1f80bf1daa489495071efbb095d75a634cf28a8bc299581244063b53176151
66
# via -r requirements.in
77
microvenv==2025.0 \
88
--hash=sha256:568155ec18af01c89f270d35d123ab803b09672b480c3702d15fd69e9cc5bd1e \

src/client/common/application/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export interface ICommandNameArgumentTypeMapping extends ICommandNameWithoutArgu
8787
['jupyter.opennotebook']: [undefined | Uri, undefined | CommandSource];
8888
['jupyter.runallcells']: [Uri];
8989
['extension.open']: [string];
90-
['workbench.action.openIssueReporter']: [{ extensionId: string; issueBody: string }];
90+
['workbench.action.openIssueReporter']: [{ extensionId: string; issueBody: string; extensionData?: string }];
9191
[Commands.GetSelectedInterpreterPath]: [{ workspaceFolder: string } | string[]];
9292
[Commands.TriggerEnvironmentSelection]: [undefined | Uri];
9393
[Commands.Start_Native_REPL]: [undefined | Uri];

0 commit comments

Comments
 (0)