From d7c997daeb0bb4178bb502665dcfd507090bf2d2 Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Thu, 21 Dec 2023 21:04:13 -0600 Subject: [PATCH] Get flake8 linting passing --- .flake8 | 2 +- nose2/plugins/loader/testcases.py | 2 +- nose2/plugins/loader/testclasses.py | 2 +- .../ignore_passing/test_prettyassert_ignore_passing.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.flake8 b/.flake8 index f1520990..8175ac83 100644 --- a/.flake8 +++ b/.flake8 @@ -1,4 +1,4 @@ [flake8] exclude = .git,.tox,__pycache__,.eggs,dist,.venv*,docs,build max-line-length = 88 -extend-ignore = W503,W504,E203 +extend-ignore = W503,W504,E203,B011 diff --git a/nose2/plugins/loader/testcases.py b/nose2/plugins/loader/testcases.py index 3ed53c26..fc0170e0 100644 --- a/nose2/plugins/loader/testcases.py +++ b/nose2/plugins/loader/testcases.py @@ -95,8 +95,8 @@ def isTestMethod(attrname, testCaseClass=testCaseClass, excluded=excluded): prefix = evt.testMethodPrefix or self.session.testMethodPrefix return ( attrname.startswith(prefix) - and hasattr(getattr(testCaseClass, attrname), "__call__") and attrname not in excluded + and callable(getattr(testCaseClass, attrname)) ) evt = events.GetTestCaseNamesEvent(event.loader, testCaseClass, isTestMethod) diff --git a/nose2/plugins/loader/testclasses.py b/nose2/plugins/loader/testclasses.py index d6952aaa..b26b320e 100644 --- a/nose2/plugins/loader/testclasses.py +++ b/nose2/plugins/loader/testclasses.py @@ -173,8 +173,8 @@ def isTestMethod(attrname, cls=cls, excluded=excluded): prefix = self.session.testMethodPrefix return ( attrname.startswith(prefix) - and hasattr(getattr(cls, attrname), "__call__") and attrname not in excluded + and callable(getattr(cls, attrname)) ) evt = GetTestMethodNamesEvent(event.loader, cls, isTestMethod) diff --git a/nose2/tests/functional/support/scenario/pretty_asserts/ignore_passing/test_prettyassert_ignore_passing.py b/nose2/tests/functional/support/scenario/pretty_asserts/ignore_passing/test_prettyassert_ignore_passing.py index 99e3f4ad..7bb5ff62 100644 --- a/nose2/tests/functional/support/scenario/pretty_asserts/ignore_passing/test_prettyassert_ignore_passing.py +++ b/nose2/tests/functional/support/scenario/pretty_asserts/ignore_passing/test_prettyassert_ignore_passing.py @@ -1,3 +1,4 @@ +# flake8: noqa import unittest @@ -6,7 +7,6 @@ def test_failing_assert(self): x = True y = False # fmt: off - # ruff: noqa assert x; assert y # fmt: on