Skip to content

Commit 97a8270

Browse files
authored
Merge branch 'main' into seamus/avoid-eager-test-refresh-for-non-test-files
2 parents b5c1b48 + b4aa112 commit 97a8270

39 files changed

+1161
-762
lines changed

.github/release_plan.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ Feature freeze is Monday @ 17:00 America/Vancouver, XXX XX. At that point, commi
2424
</details>
2525

2626

27-
# Release candidate (Monday, XXX XX)
27+
# Release candidate (Thursday, XXX XX)
28+
NOTE: This Thursday occurs during TESTING week. Branching should be done during this week to freeze the release with only the correct changes. Any last minute fixes go in as candidates into the release branch and will require team approval.
2829

30+
Other:
2931
NOTE: Third Party Notices are automatically added by our build pipelines using https://tools.opensource.microsoft.com/notice.
3032
NOTE: the number of this release is in the issue title and can be substituted in wherever you see [YYYY.minor].
3133

package-lock.json

Lines changed: 2 additions & 2 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": "2024.23.0-dev",
5+
"version": "2025.1.0-dev",
66
"featureFlags": {
77
"usingNewInterpreterStorage": true
88
},

package.nls.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"python.command.python.configureTests.title": "Configure Tests",
1616
"python.command.testing.rerunFailedTests.title": "Rerun Failed Tests",
1717
"python.command.python.execSelectionInTerminal.title": "Run Selection/Line in Python Terminal",
18-
"python.command.python.execInREPL.title": "Run Selection/Line in Python REPL",
18+
"python.command.python.execInREPL.title": "Run Selection/Line in Native Python REPL",
1919
"python.command.python.execSelectionInDjangoShell.title": "Run Selection/Line in Django Shell",
2020
"python.command.python.reportIssue.title": "Report Issue...",
2121
"python.command.python.clearCacheAndReload.title": "Clear Cache and Reload Window",

pythonExtensionApi/src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ export type EnvironmentsChangeEvent = {
227227

228228
export type ActiveEnvironmentPathChangeEvent = EnvironmentPath & {
229229
/**
230-
* Workspace folder the environment changed for.
230+
* Resource the environment changed for.
231231
*/
232-
readonly resource: WorkspaceFolder | undefined;
232+
readonly resource: Resource | undefined;
233233
};
234234

235235
/**

python_files/normalizeSelection.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,12 @@ def normalize_lines(selection):
120120

121121
# Insert a newline between each top-level statement, and append a newline to the selection.
122122
source = "\n".join(statements) + "\n"
123+
# If selection ends with trailing dictionary or list, remove last unnecessary newline.
123124
if selection[-2] == "}" or selection[-2] == "]":
124125
source = source[:-1]
126+
# If the selection contains trailing return dictionary, insert newline to trigger execute.
127+
if check_end_with_return_dict(selection):
128+
source = source + "\n"
125129
except Exception:
126130
# If there's a problem when parsing statements,
127131
# append a blank line to end the block and send it as-is.
@@ -134,6 +138,11 @@ def normalize_lines(selection):
134138
min_key = None
135139

136140

141+
def check_end_with_return_dict(code):
142+
stripped_code = code.strip()
143+
return stripped_code.endswith("}") and "return {" in stripped_code.strip()
144+
145+
137146
def check_exact_exist(top_level_nodes, start_line, end_line):
138147
return [
139148
node

python_files/pythonrc.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,8 @@ def __str__(self):
7777

7878
if sys.platform != "win32" and (not is_wsl) and use_shell_integration:
7979
sys.ps1 = PS1()
80+
81+
if sys.platform == "darwin":
82+
print("Cmd click to launch VS Code Native REPL")
83+
else:
84+
print("Ctrl click to launch VS Code Native REPL")

python_files/tests/test_normalize_selection.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,50 @@ def test_list_comp(self):
268268
result = normalizeSelection.normalize_lines(src)
269269

270270
assert result == expected
271+
272+
def test_return_dict(self):
273+
importlib.reload(normalizeSelection)
274+
src = textwrap.dedent(
275+
"""\
276+
def get_dog(name, breed):
277+
return {'name': name, 'breed': breed}
278+
"""
279+
)
280+
281+
expected = textwrap.dedent(
282+
"""\
283+
def get_dog(name, breed):
284+
return {'name': name, 'breed': breed}
285+
286+
"""
287+
)
288+
289+
result = normalizeSelection.normalize_lines(src)
290+
291+
assert result == expected
292+
293+
def test_return_dict2(self):
294+
importlib.reload(normalizeSelection)
295+
src = textwrap.dedent(
296+
"""\
297+
def get_dog(name, breed):
298+
return {'name': name, 'breed': breed}
299+
300+
dog = get_dog('Ahri', 'Pomeranian')
301+
print(dog)
302+
"""
303+
)
304+
305+
expected = textwrap.dedent(
306+
"""\
307+
def get_dog(name, breed):
308+
return {'name': name, 'breed': breed}
309+
310+
dog = get_dog('Ahri', 'Pomeranian')
311+
print(dog)
312+
"""
313+
)
314+
315+
result = normalizeSelection.normalize_lines(src)
316+
317+
assert result == expected

python_files/tests/test_shell_integration.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,23 @@ def test_excepthook_call():
6161

6262
hooks.my_excepthook("mock_type", "mock_value", "mock_traceback")
6363
mock_excepthook.assert_called_once_with("mock_type", "mock_value", "mock_traceback")
64+
65+
66+
if sys.platform == "darwin":
67+
68+
def test_print_statement_darwin(monkeypatch):
69+
importlib.reload(pythonrc)
70+
with monkeypatch.context() as m:
71+
m.setattr("builtins.print", Mock())
72+
importlib.reload(sys.modules["pythonrc"])
73+
print.assert_any_call("Cmd click to launch VS Code Native REPL")
74+
75+
76+
if sys.platform == "win32":
77+
78+
def test_print_statement_non_darwin(monkeypatch):
79+
importlib.reload(pythonrc)
80+
with monkeypatch.context() as m:
81+
m.setattr("builtins.print", Mock())
82+
importlib.reload(sys.modules["pythonrc"])
83+
print.assert_any_call("Ctrl click to launch VS Code Native REPL")

python_files/vscode_pytest/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,11 @@ def pytest_sessionfinish(session, exitstatus):
462462
except NoSource:
463463
# as per issue 24308 this best way to handle this edge case
464464
continue
465+
except Exception as e:
466+
print(
467+
f"Plugin error[vscode-pytest]: Skipping analysis of file: {file} due to error: {e}"
468+
)
469+
continue
465470
lines_executable = {int(line_no) for line_no in analysis[1]}
466471
lines_missed = {int(line_no) for line_no in analysis[3]}
467472
lines_covered = lines_executable - lines_missed

0 commit comments

Comments
 (0)