Skip to content

Commit 84cc5b7

Browse files
pre-commit-ci[bot]Glyphack
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 851d276 commit 84cc5b7

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

Diff for: src/_pytest/fixtures.py

+10-16
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def get_scope_node(node: nodes.Node, scope: Scope) -> nodes.Node | None:
150150
assert_never(scope)
151151

152152

153-
def getfixturemarker(obj: object) -> Optional["FixtureFunctionMarker"]:
153+
def getfixturemarker(obj: object) -> FixtureFunctionMarker | None:
154154
"""Return fixturemarker or None if it doesn't exist"""
155155
if isinstance(obj, FixtureFunctionDefinition):
156156
return obj._fixture_function_marker
@@ -1153,7 +1153,7 @@ class FixtureFunctionMarker:
11531153
def __post_init__(self, _ispytest: bool) -> None:
11541154
check_ispytest(_ispytest)
11551155

1156-
def __call__(self, function: FixtureFunction) -> "FixtureFunctionDefinition":
1156+
def __call__(self, function: FixtureFunction) -> FixtureFunctionDefinition:
11571157
if inspect.isclass(function):
11581158
raise ValueError("class fixtures not supported (maybe in the future)")
11591159

@@ -1183,7 +1183,7 @@ def __init__(
11831183
self,
11841184
function: Callable[..., Any],
11851185
fixture_function_marker: FixtureFunctionMarker,
1186-
instance: Optional[type] = None,
1186+
instance: type | None = None,
11871187
):
11881188
self.name = fixture_function_marker.name or function.__name__
11891189
self.__name__ = self.name
@@ -1223,10 +1223,8 @@ def fixture(
12231223
scope: _ScopeName | Callable[[str, Config], _ScopeName] = ...,
12241224
params: Iterable[object] | None = ...,
12251225
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 = ...,
12301228
) -> FixtureFunctionDefinition: ...
12311229

12321230

@@ -1237,10 +1235,8 @@ def fixture(
12371235
scope: _ScopeName | Callable[[str, Config], _ScopeName] = ...,
12381236
params: Iterable[object] | None = ...,
12391237
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,
12441240
) -> FixtureFunctionDefinition: ...
12451241

12461242

@@ -1250,11 +1246,9 @@ def fixture(
12501246
scope: _ScopeName | Callable[[str, Config], _ScopeName] = "function",
12511247
params: Iterable[object] | None = None,
12521248
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:
12581252
"""Decorator to mark a fixture factory function.
12591253
12601254
This decorator can be used, with or without parameters, to define a

0 commit comments

Comments
 (0)