6
6
import os
7
7
import sys
8
8
import types
9
- import typing
10
9
import warnings
11
10
from collections import Counter
12
11
from collections import defaultdict
13
- from collections .abc import Sequence
14
12
from functools import partial
15
13
from typing import Any
16
14
from typing import Callable
21
19
from typing import List
22
20
from typing import Mapping
23
21
from typing import Optional
22
+ from typing import Sequence
24
23
from typing import Set
25
24
from typing import Tuple
26
25
from typing import TYPE_CHECKING
@@ -668,7 +667,7 @@ def _recurse(self, direntry: "os.DirEntry[str]") -> bool:
668
667
669
668
def _collectfile (
670
669
self , path : py .path .local , handle_dupes : bool = True
671
- ) -> typing . Sequence [nodes .Collector ]:
670
+ ) -> Sequence [nodes .Collector ]:
672
671
assert (
673
672
path .isfile ()
674
673
), "{!r} is not a file (isdir={!r}, exists={!r}, islink={!r})" .format (
@@ -904,7 +903,7 @@ def id(self) -> str:
904
903
def setmulti2 (
905
904
self ,
906
905
valtypes : Mapping [str , "Literal['params', 'funcargs']" ],
907
- argnames : typing . Sequence [str ],
906
+ argnames : Sequence [str ],
908
907
valset : Iterable [object ],
909
908
id : str ,
910
909
marks : Iterable [Union [Mark , MarkDecorator ]],
@@ -966,8 +965,8 @@ def __init__(
966
965
def parametrize (
967
966
self ,
968
967
argnames : Union [str , List [str ], Tuple [str , ...]],
969
- argvalues : Iterable [Union [ParameterSet , typing . Sequence [object ], object ]],
970
- indirect : Union [bool , typing . Sequence [str ]] = False ,
968
+ argvalues : Iterable [Union [ParameterSet , Sequence [object ], object ]],
969
+ indirect : Union [bool , Sequence [str ]] = False ,
971
970
ids : Optional [
972
971
Union [
973
972
Iterable [Union [None , str , float , int , bool ]],
@@ -1093,14 +1092,14 @@ def parametrize(
1093
1092
1094
1093
def _resolve_arg_ids (
1095
1094
self ,
1096
- argnames : typing . Sequence [str ],
1095
+ argnames : Sequence [str ],
1097
1096
ids : Optional [
1098
1097
Union [
1099
1098
Iterable [Union [None , str , float , int , bool ]],
1100
1099
Callable [[Any ], Optional [object ]],
1101
1100
]
1102
1101
],
1103
- parameters : typing . Sequence [ParameterSet ],
1102
+ parameters : Sequence [ParameterSet ],
1104
1103
nodeid : str ,
1105
1104
) -> List [str ]:
1106
1105
"""Resolve the actual ids for the given argnames, based on the ``ids`` parameter given
@@ -1127,7 +1126,7 @@ def _resolve_arg_ids(
1127
1126
def _validate_ids (
1128
1127
self ,
1129
1128
ids : Iterable [Union [None , str , float , int , bool ]],
1130
- parameters : typing . Sequence [ParameterSet ],
1129
+ parameters : Sequence [ParameterSet ],
1131
1130
func_name : str ,
1132
1131
) -> List [Union [None , str ]]:
1133
1132
try :
@@ -1162,9 +1161,7 @@ def _validate_ids(
1162
1161
return new_ids
1163
1162
1164
1163
def _resolve_arg_value_types (
1165
- self ,
1166
- argnames : typing .Sequence [str ],
1167
- indirect : Union [bool , typing .Sequence [str ]],
1164
+ self , argnames : Sequence [str ], indirect : Union [bool , Sequence [str ]],
1168
1165
) -> Dict [str , "Literal['params', 'funcargs']" ]:
1169
1166
"""Resolve if each parametrized argument must be considered a
1170
1167
parameter to a fixture or a "funcarg" to the function, based on the
@@ -1202,9 +1199,7 @@ def _resolve_arg_value_types(
1202
1199
return valtypes
1203
1200
1204
1201
def _validate_if_using_arg_names (
1205
- self ,
1206
- argnames : typing .Sequence [str ],
1207
- indirect : Union [bool , typing .Sequence [str ]],
1202
+ self , argnames : Sequence [str ], indirect : Union [bool , Sequence [str ]],
1208
1203
) -> None :
1209
1204
"""Check if all argnames are being used, by default values, or directly/indirectly.
1210
1205
@@ -1235,9 +1230,9 @@ def _validate_if_using_arg_names(
1235
1230
1236
1231
1237
1232
def _find_parametrized_scope (
1238
- argnames : typing . Sequence [str ],
1239
- arg2fixturedefs : Mapping [str , typing . Sequence [fixtures .FixtureDef [object ]]],
1240
- indirect : Union [bool , typing . Sequence [str ]],
1233
+ argnames : Sequence [str ],
1234
+ arg2fixturedefs : Mapping [str , Sequence [fixtures .FixtureDef [object ]]],
1235
+ indirect : Union [bool , Sequence [str ]],
1241
1236
) -> "fixtures._Scope" :
1242
1237
"""Find the most appropriate scope for a parametrized call based on its arguments.
1243
1238
0 commit comments