Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 1ebb7c0

Browse files
committed
fix tests
1 parent 969ddd3 commit 1ebb7c0

File tree

3 files changed

+38
-9
lines changed

3 files changed

+38
-9
lines changed

noxfile.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from pathlib import Path
22

3-
from nox import Session, session
3+
from nox import Session, parametrize, session
44

55
ROOT = Path(".")
66
REQUIREMENTS_DIR = ROOT / "requirements"
@@ -36,8 +36,10 @@ def test_types(session: Session) -> None:
3636

3737

3838
@session
39-
def test_suite(session: Session) -> None:
39+
@parametrize("flake8_version", ["3", "4", "5", "6"])
40+
def test_suite(session: Session, flake8_version: str) -> None:
4041
install_requirements(session, "test-env")
42+
session.install(f"flake8=={flake8_version}.*")
4143
session.install(".")
4244
session.run("pytest", "tests")
4345

reactpy_flake8/flake8_plugin.py

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717

1818
class Plugin:
19-
2019
name = __name__
2120
version = __version__
2221

tests/test_cases.py

+34-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33
from pathlib import Path
44

5+
import flake8
56
import pytest
67
from flake8.options.manager import OptionManager
78

@@ -12,15 +13,42 @@
1213

1314

1415
def setup_plugin(args):
15-
options_manager = OptionManager(
16-
version="0.0.0",
17-
plugin_versions=reactpy_flake8.__version__,
18-
parents=[],
19-
)
16+
if flake8.__version_info__ >= (6,):
17+
options_manager = OptionManager(
18+
version="",
19+
plugin_versions="",
20+
parents=[],
21+
formatter_names=[],
22+
)
23+
elif flake8.__version_info__ >= (5,):
24+
options_manager = OptionManager(
25+
version="",
26+
plugin_versions="",
27+
parents=[],
28+
)
29+
elif flake8.__version_info__ >= (4,):
30+
options_manager = OptionManager(
31+
version="",
32+
parents=[],
33+
prog="",
34+
)
35+
elif flake8.__version_info__ >= (3, 7):
36+
options_manager = OptionManager(
37+
version="",
38+
parents=[],
39+
prog="",
40+
)
41+
else:
42+
raise RuntimeError("Unsupported flake8 version")
2043

2144
plugin = Plugin()
2245
plugin.add_options(options_manager)
23-
options = options_manager.parse_args(args)
46+
47+
if flake8.__version_info__ >= (5,):
48+
options = options_manager.parse_args(args)
49+
else:
50+
options, _ = options_manager.parse_args(args)
51+
2452
plugin.parse_options(options)
2553

2654
return plugin

0 commit comments

Comments
 (0)