Skip to content

Commit e051059

Browse files
committed
FIx python 3.8 and linter issues.
1 parent 0b68825 commit e051059

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

python_files/unittestadapter/django_handler.py

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

4-
import importlib.util
54
import os
65
import pathlib
76
import subprocess
87
import sys
98
from contextlib import contextmanager, suppress
10-
from typing import TYPE_CHECKING, Generator, List
11-
12-
if TYPE_CHECKING:
13-
from importlib.machinery import ModuleSpec
14-
9+
from typing import Generator, List
1510

1611
script_dir = pathlib.Path(__file__).parent
1712
sys.path.append(os.fspath(script_dir))
@@ -104,11 +99,10 @@ def django_execution_runner(manage_py_path: str, test_ids: List[str], args: List
10499
print(f"Django manage.py arguments: {manage_argv}")
105100

106101
try:
107-
with (
108-
override_argv(manage_argv),
109-
suppress(SystemExit),
110-
manage_path.open() as manage_file,
111-
):
102+
argv_context = override_argv(manage_argv)
103+
suppress_context = suppress(SystemExit)
104+
manage_file = manage_path.open()
105+
with argv_context, suppress_context, manage_file:
112106
manage_code = manage_file.read()
113107
exec(manage_code, {"__name__": "__main__"})
114108
except OSError as e:

0 commit comments

Comments
 (0)