Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
atollk committed Jul 14, 2023
1 parent b80d16a commit ed13db0
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 18 deletions.
5 changes: 1 addition & 4 deletions flake8_classmethod_staticmethod/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
"CSM131",
]

PYTHON_38 = sys.version_info >= (3, 8)


class Checker:
"""
flake8 plugin that checks rules regarding the staticmethod and classmethod decorators.
Expand Down Expand Up @@ -44,7 +41,7 @@ def parse_options(
extra_args,
):
cls.enabled_errors = [
int(option[4:]) for option in options.select_csm1
int(option[3:]) for option in options.select_csm1
]

def run(self) -> Iterable[Tuple[int, int, str, type]]:
Expand Down
3 changes: 1 addition & 2 deletions tests/test_clst100.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from flake8_classmethod_staticmethod.checker import PYTHON_38
from tests.util import BaseTest


Expand Down Expand Up @@ -27,4 +26,4 @@ def bar():
pass
"""
result = self.run_flake8(code)
self.assert_error_at(result, "CSM100", 3 if PYTHON_38 else 2, 5)
self.assert_error_at(result, "CSM100", 4, 5)
3 changes: 1 addition & 2 deletions tests/test_clst101.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from flake8_classmethod_staticmethod.checker import PYTHON_38
from tests.util import BaseTest


Expand Down Expand Up @@ -37,4 +36,4 @@ def bar():
return Foo.__name__
"""
result = self.run_flake8(code)
self.assert_error_at(result, "CSM101", 3 if PYTHON_38 else 2, 5)
self.assert_error_at(result, "CSM101", 4, 5)
3 changes: 1 addition & 2 deletions tests/test_clst130.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from flake8_classmethod_staticmethod.checker import PYTHON_38
from tests.util import BaseTest


Expand Down Expand Up @@ -27,4 +26,4 @@ def bar(cls):
pass
"""
result = self.run_flake8(code)
self.assert_error_at(result, "CSM130", 3 if PYTHON_38 else 2, 5)
self.assert_error_at(result, "CSM130", 4, 5)
3 changes: 1 addition & 2 deletions tests/test_clst131.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from flake8_classmethod_staticmethod.checker import PYTHON_38
from tests.util import BaseTest


Expand Down Expand Up @@ -40,4 +39,4 @@ def bar(cls):
return 123
"""
result = self.run_flake8(code)
self.assert_error_at(result, "CSM131", 3 if PYTHON_38 else 2, 5)
self.assert_error_at(result, "CSM131", 4, 5)
3 changes: 1 addition & 2 deletions tests/test_clst132.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from flake8_classmethod_staticmethod.checker import PYTHON_38
from tests.util import BaseTest


Expand Down Expand Up @@ -41,4 +40,4 @@ def bar(cls):
return Foo.__name__
"""
result = self.run_flake8(code)
self.assert_error_at(result, "CSM132", 3 if PYTHON_38 else 2, 5)
self.assert_error_at(result, "CSM132", 4, 5)
7 changes: 3 additions & 4 deletions tests/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


class Test_General:
def test_pass_1(self, flake8dir):
def test_pass_1(self, flake8_path):
code = """
class Foo:
@some_decorator(123) # noqa
Expand All @@ -12,8 +12,7 @@ def bar(self):
@other.decorator(key=123) # noqa
def baz(self):
pass
"""
flake8dir.make_example_py(textwrap.dedent(code))
result = flake8dir.run_flake8()
(flake8_path / "example.py").write_text(textwrap.dedent(code))
result = flake8_path.run_flake8()
assert result.exit_code == 0

0 comments on commit ed13db0

Please sign in to comment.