Ignore depredcated warns(None) overload errors from mypy

This commit is contained in:
Olga Matoula 2021-05-17 09:50:59 +01:00
parent dd8ad3fa9c
commit 3f414d7bbe
4 changed files with 4 additions and 4 deletions

View File

@ -84,7 +84,7 @@ def deprecated_call(
@overload @overload
def warns( def warns(
expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]], expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]] = ...,
*, *,
match: Optional[Union[str, Pattern[str]]] = ..., match: Optional[Union[str, Pattern[str]]] = ...,
) -> "WarningsChecker": ) -> "WarningsChecker":

View File

@ -188,5 +188,5 @@ def test_warns_none_is_deprecated():
"Replace pytest.warns(None) by simply pytest.warns()." "Replace pytest.warns(None) by simply pytest.warns()."
), ),
): ):
with pytest.warns(None): with pytest.warns(None): # type: ignore[call-overload]
pass pass

View File

@ -310,7 +310,7 @@ class TestWarns:
# This should become an error when WARNS_NONE_ARG is removed in Pytest 7.0 # This should become an error when WARNS_NONE_ARG is removed in Pytest 7.0
with warnings.catch_warnings(): with warnings.catch_warnings():
warnings.simplefilter("ignore") warnings.simplefilter("ignore")
with pytest.warns(None) as record: with pytest.warns(None) as record: # type: ignore[call-overload]
warnings.warn("user", UserWarning) warnings.warn("user", UserWarning)
warnings.warn("runtime", RuntimeWarning) warnings.warn("runtime", RuntimeWarning)

View File

@ -403,7 +403,7 @@ class TestRmRf:
# ignored function # ignored function
with warnings.catch_warnings(): with warnings.catch_warnings():
warnings.simplefilter("ignore") warnings.simplefilter("ignore")
with pytest.warns(None) as warninfo: with pytest.warns(None) as warninfo: # type: ignore[call-overload]
exc_info4 = (None, PermissionError(), None) exc_info4 = (None, PermissionError(), None)
on_rm_rf_error(os.open, str(fn), exc_info4, start_path=tmp_path) on_rm_rf_error(os.open, str(fn), exc_info4, start_path=tmp_path)
assert fn.is_file() assert fn.is_file()