Remove no longer needed noqa: F821 uses
Not needed since pyflakes 2.2.0.
This commit is contained in:
@@ -724,10 +724,10 @@ class TestSorting:
|
||||
assert fn1 != fn3
|
||||
|
||||
for fn in fn1, fn2, fn3:
|
||||
assert fn != 3 # type: ignore[comparison-overlap] # noqa: F821
|
||||
assert fn != 3 # type: ignore[comparison-overlap]
|
||||
assert fn != modcol
|
||||
assert fn != [1, 2, 3] # type: ignore[comparison-overlap] # noqa: F821
|
||||
assert [1, 2, 3] != fn # type: ignore[comparison-overlap] # noqa: F821
|
||||
assert fn != [1, 2, 3] # type: ignore[comparison-overlap]
|
||||
assert [1, 2, 3] != fn # type: ignore[comparison-overlap]
|
||||
assert modcol != fn
|
||||
|
||||
def test_allow_sane_sorting_for_decorators(self, testdir):
|
||||
|
||||
@@ -3850,7 +3850,7 @@ class TestScopeOrdering:
|
||||
)
|
||||
testdir.runpytest()
|
||||
# actual fixture execution differs: dependent fixtures must be created first ("my_tmpdir")
|
||||
FIXTURE_ORDER = pytest.FIXTURE_ORDER # type: ignore[attr-defined] # noqa: F821
|
||||
FIXTURE_ORDER = pytest.FIXTURE_ORDER # type: ignore[attr-defined]
|
||||
assert FIXTURE_ORDER == "s1 my_tmpdir_factory p1 m1 my_tmpdir f1 f2".split()
|
||||
|
||||
def test_func_closure_module(self, testdir):
|
||||
@@ -4159,7 +4159,7 @@ def test_fixture_duplicated_arguments() -> None:
|
||||
"""Raise error if there are positional and keyword arguments for the same parameter (#1682)."""
|
||||
with pytest.raises(TypeError) as excinfo:
|
||||
|
||||
@pytest.fixture("session", scope="session") # type: ignore[call-overload] # noqa: F821
|
||||
@pytest.fixture("session", scope="session") # type: ignore[call-overload]
|
||||
def arg(arg):
|
||||
pass
|
||||
|
||||
@@ -4171,7 +4171,7 @@ def test_fixture_duplicated_arguments() -> None:
|
||||
|
||||
with pytest.raises(TypeError) as excinfo:
|
||||
|
||||
@pytest.fixture( # type: ignore[call-overload] # noqa: F821
|
||||
@pytest.fixture( # type: ignore[call-overload]
|
||||
"function",
|
||||
["p1"],
|
||||
True,
|
||||
@@ -4199,7 +4199,7 @@ def test_fixture_with_positionals() -> None:
|
||||
|
||||
with pytest.warns(pytest.PytestDeprecationWarning) as warnings:
|
||||
|
||||
@pytest.fixture("function", [0], True) # type: ignore[call-overload] # noqa: F821
|
||||
@pytest.fixture("function", [0], True) # type: ignore[call-overload]
|
||||
def fixture_with_positionals():
|
||||
pass
|
||||
|
||||
@@ -4213,7 +4213,7 @@ def test_fixture_with_positionals() -> None:
|
||||
def test_fixture_with_too_many_positionals() -> None:
|
||||
with pytest.raises(TypeError) as excinfo:
|
||||
|
||||
@pytest.fixture("function", [0], True, ["id"], "name", "extra") # type: ignore[call-overload] # noqa: F821
|
||||
@pytest.fixture("function", [0], True, ["id"], "name", "extra") # type: ignore[call-overload]
|
||||
def fixture_with_positionals():
|
||||
pass
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class TestMetafunc:
|
||||
pytest.raises(ValueError, lambda: metafunc.parametrize("y", [5, 6]))
|
||||
|
||||
with pytest.raises(TypeError, match="^ids must be a callable or an iterable$"):
|
||||
metafunc.parametrize("y", [5, 6], ids=42) # type: ignore[arg-type] # noqa: F821
|
||||
metafunc.parametrize("y", [5, 6], ids=42) # type: ignore[arg-type]
|
||||
|
||||
def test_parametrize_error_iterator(self) -> None:
|
||||
def func(x):
|
||||
@@ -95,7 +95,7 @@ class TestMetafunc:
|
||||
metafunc = self.Metafunc(func)
|
||||
# When the input is an iterator, only len(args) are taken,
|
||||
# so the bad Exc isn't reached.
|
||||
metafunc.parametrize("x", [1, 2], ids=gen()) # type: ignore[arg-type] # noqa: F821
|
||||
metafunc.parametrize("x", [1, 2], ids=gen()) # type: ignore[arg-type]
|
||||
assert [(x.funcargs, x.id) for x in metafunc._calls] == [
|
||||
({"x": 1}, "0"),
|
||||
({"x": 2}, "2"),
|
||||
@@ -107,7 +107,7 @@ class TestMetafunc:
|
||||
r" Exc\(from_gen\) \(type: <class .*Exc'>\) at index 2"
|
||||
),
|
||||
):
|
||||
metafunc.parametrize("x", [1, 2, 3], ids=gen()) # type: ignore[arg-type] # noqa: F821
|
||||
metafunc.parametrize("x", [1, 2, 3], ids=gen()) # type: ignore[arg-type]
|
||||
|
||||
def test_parametrize_bad_scope(self) -> None:
|
||||
def func(x):
|
||||
@@ -118,7 +118,7 @@ class TestMetafunc:
|
||||
fail.Exception,
|
||||
match=r"parametrize\(\) call in func got an unexpected scope value 'doggy'",
|
||||
):
|
||||
metafunc.parametrize("x", [1], scope="doggy") # type: ignore[arg-type] # noqa: F821
|
||||
metafunc.parametrize("x", [1], scope="doggy") # type: ignore[arg-type]
|
||||
|
||||
def test_parametrize_request_name(self, testdir: Testdir) -> None:
|
||||
"""Show proper error when 'request' is used as a parameter name in parametrize (#6183)"""
|
||||
@@ -675,7 +675,7 @@ class TestMetafunc:
|
||||
fail.Exception,
|
||||
match="In func: expected Sequence or boolean for indirect, got dict",
|
||||
):
|
||||
metafunc.parametrize("x, y", [("a", "b")], indirect={}) # type: ignore[arg-type] # noqa: F821
|
||||
metafunc.parametrize("x, y", [("a", "b")], indirect={}) # type: ignore[arg-type]
|
||||
|
||||
def test_parametrize_indirect_list_functional(self, testdir: Testdir) -> None:
|
||||
"""
|
||||
|
||||
@@ -8,7 +8,7 @@ from _pytest.outcomes import Failed
|
||||
class TestRaises:
|
||||
def test_check_callable(self) -> None:
|
||||
with pytest.raises(TypeError, match=r".* must be callable"):
|
||||
pytest.raises(RuntimeError, "int('qwe')") # type: ignore[call-overload] # noqa: F821
|
||||
pytest.raises(RuntimeError, "int('qwe')") # type: ignore[call-overload]
|
||||
|
||||
def test_raises(self):
|
||||
excinfo = pytest.raises(ValueError, int, "qwe")
|
||||
@@ -30,7 +30,7 @@ class TestRaises:
|
||||
|
||||
def test_raises_falsey_type_error(self) -> None:
|
||||
with pytest.raises(TypeError):
|
||||
with pytest.raises(AssertionError, match=0): # type: ignore[call-overload] # noqa: F821
|
||||
with pytest.raises(AssertionError, match=0): # type: ignore[call-overload]
|
||||
raise AssertionError("ohai")
|
||||
|
||||
def test_raises_repr_inflight(self):
|
||||
@@ -128,11 +128,11 @@ class TestRaises:
|
||||
|
||||
def test_noclass(self) -> None:
|
||||
with pytest.raises(TypeError):
|
||||
pytest.raises("wrong", lambda: None) # type: ignore[call-overload] # noqa: F821
|
||||
pytest.raises("wrong", lambda: None) # type: ignore[call-overload]
|
||||
|
||||
def test_invalid_arguments_to_raises(self) -> None:
|
||||
with pytest.raises(TypeError, match="unknown"):
|
||||
with pytest.raises(TypeError, unknown="bogus"): # type: ignore[call-overload] # noqa: F821
|
||||
with pytest.raises(TypeError, unknown="bogus"): # type: ignore[call-overload]
|
||||
raise ValueError()
|
||||
|
||||
def test_tuple(self):
|
||||
@@ -262,12 +262,12 @@ class TestRaises:
|
||||
assert False, "via __class__"
|
||||
|
||||
with pytest.raises(AssertionError) as excinfo:
|
||||
with pytest.raises(CrappyClass()): # type: ignore[call-overload] # noqa: F821
|
||||
with pytest.raises(CrappyClass()): # type: ignore[call-overload]
|
||||
pass
|
||||
assert "via __class__" in excinfo.value.args[0]
|
||||
|
||||
def test_raises_context_manager_with_kwargs(self):
|
||||
with pytest.raises(TypeError) as excinfo:
|
||||
with pytest.raises(Exception, foo="bar"): # type: ignore[call-overload] # noqa: F821
|
||||
with pytest.raises(Exception, foo="bar"): # type: ignore[call-overload]
|
||||
pass
|
||||
assert "Unexpected keyword arguments" in str(excinfo.value)
|
||||
|
||||
Reference in New Issue
Block a user