@@ -150,7 +150,7 @@ def get_scope_node(node: nodes.Node, scope: Scope) -> nodes.Node | None:
150
150
assert_never (scope )
151
151
152
152
153
- def getfixturemarker (obj : object ) -> Optional [ " FixtureFunctionMarker" ] :
153
+ def getfixturemarker (obj : object ) -> FixtureFunctionMarker | None :
154
154
"""Return fixturemarker or None if it doesn't exist"""
155
155
if isinstance (obj , FixtureFunctionDefinition ):
156
156
return obj ._fixture_function_marker
@@ -1153,7 +1153,7 @@ class FixtureFunctionMarker:
1153
1153
def __post_init__ (self , _ispytest : bool ) -> None :
1154
1154
check_ispytest (_ispytest )
1155
1155
1156
- def __call__ (self , function : FixtureFunction ) -> " FixtureFunctionDefinition" :
1156
+ def __call__ (self , function : FixtureFunction ) -> FixtureFunctionDefinition :
1157
1157
if inspect .isclass (function ):
1158
1158
raise ValueError ("class fixtures not supported (maybe in the future)" )
1159
1159
@@ -1183,7 +1183,7 @@ def __init__(
1183
1183
self ,
1184
1184
function : Callable [..., Any ],
1185
1185
fixture_function_marker : FixtureFunctionMarker ,
1186
- instance : Optional [ type ] = None ,
1186
+ instance : type | None = None ,
1187
1187
):
1188
1188
self .name = fixture_function_marker .name or function .__name__
1189
1189
self .__name__ = self .name
@@ -1223,10 +1223,8 @@ def fixture(
1223
1223
scope : _ScopeName | Callable [[str , Config ], _ScopeName ] = ...,
1224
1224
params : Iterable [object ] | None = ...,
1225
1225
autouse : bool = ...,
1226
- ids : Optional [
1227
- Union [Sequence [Optional [object ]], Callable [[Any ], Optional [object ]]]
1228
- ] = ...,
1229
- name : Optional [str ] = ...,
1226
+ ids : Sequence [object | None ] | Callable [[Any ], object | None ] | None = ...,
1227
+ name : str | None = ...,
1230
1228
) -> FixtureFunctionDefinition : ...
1231
1229
1232
1230
@@ -1237,10 +1235,8 @@ def fixture(
1237
1235
scope : _ScopeName | Callable [[str , Config ], _ScopeName ] = ...,
1238
1236
params : Iterable [object ] | None = ...,
1239
1237
autouse : bool = ...,
1240
- ids : Optional [
1241
- Union [Sequence [Optional [object ]], Callable [[Any ], Optional [object ]]]
1242
- ] = ...,
1243
- name : Optional [str ] = None ,
1238
+ ids : Sequence [object | None ] | Callable [[Any ], object | None ] | None = ...,
1239
+ name : str | None = None ,
1244
1240
) -> FixtureFunctionDefinition : ...
1245
1241
1246
1242
@@ -1250,11 +1246,9 @@ def fixture(
1250
1246
scope : _ScopeName | Callable [[str , Config ], _ScopeName ] = "function" ,
1251
1247
params : Iterable [object ] | None = None ,
1252
1248
autouse : bool = False ,
1253
- ids : Optional [
1254
- Union [Sequence [Optional [object ]], Callable [[Any ], Optional [object ]]]
1255
- ] = None ,
1256
- name : Optional [str ] = None ,
1257
- ) -> Union [FixtureFunctionMarker , FixtureFunctionDefinition ]:
1249
+ ids : Sequence [object | None ] | Callable [[Any ], object | None ] | None = None ,
1250
+ name : str | None = None ,
1251
+ ) -> FixtureFunctionMarker | FixtureFunctionDefinition :
1258
1252
"""Decorator to mark a fixture factory function.
1259
1253
1260
1254
This decorator can be used, with or without parameters, to define a
0 commit comments