Skip to content

Commit 8dcb90a

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 b8f34c9 commit 8dcb90a

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

src/_pytest/fixtures.py

Lines changed: 10 additions & 16 deletions
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
@@ -1159,7 +1159,7 @@ class FixtureFunctionMarker:
11591159
def __post_init__(self, _ispytest: bool) -> None:
11601160
check_ispytest(_ispytest)
11611161

1162-
def __call__(self, function: FixtureFunction) -> "FixtureFunctionDefinition":
1162+
def __call__(self, function: FixtureFunction) -> FixtureFunctionDefinition:
11631163
if inspect.isclass(function):
11641164
raise ValueError("class fixtures not supported (maybe in the future)")
11651165

@@ -1189,7 +1189,7 @@ def __init__(
11891189
self,
11901190
function: Callable[..., Any],
11911191
fixture_function_marker: FixtureFunctionMarker,
1192-
instance: Optional[type] = None,
1192+
instance: type | None = None,
11931193
):
11941194
self.name = fixture_function_marker.name or function.__name__
11951195
self.__name__ = self.name
@@ -1229,10 +1229,8 @@ def fixture(
12291229
scope: _ScopeName | Callable[[str, Config], _ScopeName] = ...,
12301230
params: Iterable[object] | None = ...,
12311231
autouse: bool = ...,
1232-
ids: Optional[
1233-
Union[Sequence[Optional[object]], Callable[[Any], Optional[object]]]
1234-
] = ...,
1235-
name: Optional[str] = ...,
1232+
ids: Sequence[object | None] | Callable[[Any], object | None] | None = ...,
1233+
name: str | None = ...,
12361234
) -> FixtureFunctionDefinition: ...
12371235

12381236

@@ -1243,10 +1241,8 @@ def fixture(
12431241
scope: _ScopeName | Callable[[str, Config], _ScopeName] = ...,
12441242
params: Iterable[object] | None = ...,
12451243
autouse: bool = ...,
1246-
ids: Optional[
1247-
Union[Sequence[Optional[object]], Callable[[Any], Optional[object]]]
1248-
] = ...,
1249-
name: Optional[str] = None,
1244+
ids: Sequence[object | None] | Callable[[Any], object | None] | None = ...,
1245+
name: str | None = None,
12501246
) -> FixtureFunctionDefinition: ...
12511247

12521248

@@ -1256,11 +1252,9 @@ def fixture(
12561252
scope: _ScopeName | Callable[[str, Config], _ScopeName] = "function",
12571253
params: Iterable[object] | None = None,
12581254
autouse: bool = False,
1259-
ids: Optional[
1260-
Union[Sequence[Optional[object]], Callable[[Any], Optional[object]]]
1261-
] = None,
1262-
name: Optional[str] = None,
1263-
) -> Union[FixtureFunctionMarker, FixtureFunctionDefinition]:
1255+
ids: Sequence[object | None] | Callable[[Any], object | None] | None = None,
1256+
name: str | None = None,
1257+
) -> FixtureFunctionMarker | FixtureFunctionDefinition:
12641258
"""Decorator to mark a fixture factory function.
12651259
12661260
This decorator can be used, with or without parameters, to define a

0 commit comments

Comments
 (0)