Skip to content

Commit 5dec7cd

Browse files
committed
Add typing_extensions for NotRequired support and update imports
1 parent cfce9b4 commit 5dec7cd

4 files changed

Lines changed: 14 additions & 1 deletion

File tree

build/test-requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ namedpipe; platform_system == "Windows"
2828
# typing for Django files
2929
django-stubs
3030

31+
# Required for NotRequired import in adapter modules
32+
typing_extensions
33+
3134
coverage
3235
pytest-cov
3336
pytest-json

python_files/unittestadapter/django_test_runner.py

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

4+
from __future__ import annotations
5+
46
import os
57
import pathlib
68
import sys

python_files/unittestadapter/pvsc_utils.py

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

4+
from __future__ import annotations
5+
46
import argparse
57
import atexit
68
import doctest

python_files/vscode_pytest/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@
1616
Dict,
1717
Generator,
1818
Literal,
19-
NotRequired,
2019
Protocol,
2120
TypedDict,
2221
cast,
2322
)
2423

24+
# NotRequired is only available in typing from Python 3.11+
25+
# For earlier versions, use typing_extensions
26+
try:
27+
from typing import NotRequired
28+
except ImportError:
29+
from typing_extensions import NotRequired
30+
2531
import pytest
2632

2733
if TYPE_CHECKING:

0 commit comments

Comments
 (0)