Skip to content

Commit e334930

Browse files
authored
Merge pull request #355 from espressif/fix/literal
fix: typing.Literal not working in python 3.7
2 parents fb11ef2 + 9e9ade0 commit e334930

File tree

1 file changed

+8
-1
lines changed
  • pytest-embedded-idf/pytest_embedded_idf

1 file changed

+8
-1
lines changed

pytest-embedded-idf/pytest_embedded_idf/utils.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
import typing as t
23
from contextvars import ContextVar
34

@@ -9,6 +10,12 @@
910
preview_targets = ContextVar('preview_targets', default=PREVIEW_TARGETS)
1011

1112

13+
if sys.version_info < (3, 8):
14+
from typing_extensions import Literal
15+
else:
16+
from typing import Literal
17+
18+
1219
def _expand_target_values(values: t.List[t.List[t.Any]], target_index: int) -> t.List[t.List[t.Any]]:
1320
"""
1421
Expands target-specific values into individual test cases.
@@ -93,7 +100,7 @@ def decorator(func):
93100
return decorator
94101

95102

96-
ValidTargets = t.Literal['supported_targets', 'preview_targets', 'all']
103+
ValidTargets = Literal['supported_targets', 'preview_targets', 'all']
97104

98105

99106
def soc_filtered_targets(soc_statement: str, targets: ValidTargets = 'all') -> t.List[str]:

0 commit comments

Comments
 (0)