forked from test_framework/pytest-bdd
Fix types
This commit is contained in:
parent
b112f56e06
commit
3e49f3b6df
|
@ -26,7 +26,7 @@ from .steps import get_step_fixture_name, inject_fixture
|
|||
from .utils import CONFIG_STACK, get_args, get_caller_module_locals, get_caller_module_path
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from typing import Any, Callable, Iterator
|
||||
from typing import Any, Callable, Iterable
|
||||
|
||||
from _pytest.mark.structures import ParameterSet
|
||||
|
||||
|
@ -179,7 +179,7 @@ def _get_scenario_decorator(
|
|||
# We need to tell pytest that the original function requires its fixtures,
|
||||
# otherwise indirect fixtures would not work.
|
||||
@pytest.mark.usefixtures(*func_args)
|
||||
def scenario_wrapper(request: FixtureRequest, _pytest_bdd_example: dict[str, str]) -> Any | None:
|
||||
def scenario_wrapper(request: FixtureRequest, _pytest_bdd_example: dict[str, str]) -> Any:
|
||||
scenario = templated_scenario.render(_pytest_bdd_example)
|
||||
_execute_scenario(feature, scenario, request)
|
||||
fixture_values = [request.getfixturevalue(arg) for arg in func_args]
|
||||
|
@ -277,7 +277,7 @@ def make_string_literal(string: str) -> str:
|
|||
return "'{}'".format(string.replace("'", "\\'"))
|
||||
|
||||
|
||||
def get_python_name_generator(name: str) -> Iterator[Iterator | Iterator[str]]:
|
||||
def get_python_name_generator(name: str) -> Iterable[str]:
|
||||
"""Generate a sequence of suitable python names out of given arbitrary string name."""
|
||||
python_name = make_python_name(name)
|
||||
suffix = ""
|
||||
|
|
|
@ -23,7 +23,7 @@ class OfType:
|
|||
def __init__(self, type: type = None) -> None:
|
||||
self.type = type
|
||||
|
||||
def __eq__(self, other: Union[int, str]) -> bool:
|
||||
def __eq__(self, other: object) -> bool:
|
||||
return isinstance(other, self.type) if self.type else True
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ class OfType:
|
|||
def __init__(self, type: type = None) -> None:
|
||||
self.type = type
|
||||
|
||||
def __eq__(self, other: float) -> bool:
|
||||
def __eq__(self, other: object) -> bool:
|
||||
return isinstance(other, self.type) if self.type else True
|
||||
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@ if PYTEST_6:
|
|||
errors: int = 0,
|
||||
xpassed: int = 0,
|
||||
xfailed: int = 0,
|
||||
) -> Any | None:
|
||||
) -> None:
|
||||
"""Compatibility function for result.assert_outcomes"""
|
||||
return result.assert_outcomes(
|
||||
result.assert_outcomes(
|
||||
errors=errors, passed=passed, skipped=skipped, failed=failed, xpassed=xpassed, xfailed=xfailed
|
||||
)
|
||||
|
||||
|
@ -34,15 +34,15 @@ else:
|
|||
|
||||
def assert_outcomes(
|
||||
result: RunResult,
|
||||
passed=0,
|
||||
skipped=0,
|
||||
failed=0,
|
||||
errors=0,
|
||||
xpassed=0,
|
||||
xfailed=0,
|
||||
):
|
||||
passed: int = 0,
|
||||
skipped: int = 0,
|
||||
failed: int = 0,
|
||||
errors: int = 0,
|
||||
xpassed: int = 0,
|
||||
xfailed: int = 0,
|
||||
) -> None:
|
||||
"""Compatibility function for result.assert_outcomes"""
|
||||
return result.assert_outcomes(
|
||||
result.assert_outcomes(
|
||||
error=errors, # Pytest < 6 uses the singular form
|
||||
passed=passed,
|
||||
skipped=skipped,
|
||||
|
|
Loading…
Reference in New Issue