Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8c09d25

Browse files
committed
add typing and error message
1 parentd19e2f3 commit8c09d25

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎python_files/unittestadapter/django_handler.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4+
fromimportlib.machineryimportModuleSpec
45
importimportlib.util
56
importos
67
importpathlib
@@ -89,7 +90,11 @@ def django_execution_runner(manage_py_path: str, test_ids: List[str], args: List
8990
sys.path.insert(0,os.fspath(django_project_dir))
9091
print(f"Django project directory:{django_project_dir}")
9192

92-
manage_spec=importlib.util.spec_from_file_location("manage",manage_py_path)
93+
manage_spec:ModuleSpec|None=importlib.util.spec_from_file_location(
94+
"manage",manage_py_path
95+
)
96+
ifmanage_specisNoneormanage_spec.loaderisNone:
97+
raiseVSCodeUnittestError("Error importing manage.py when running Django testing.")
9398
manage_module=importlib.util.module_from_spec(manage_spec)
9499
manage_spec.loader.exec_module(manage_module)
95100

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp