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

Commit a229cd3

Browse files
committed
fix tests
1 parent c5dbe82 commit a229cd3

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

noxfile.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
def test(session: Session) -> None:
1111
session.notify("test_style")
1212
session.notify("test_types")
13+
session.notify("test_coverage")
1314
session.notify("test_suite")
1415

1516

@@ -29,8 +30,16 @@ def test_types(session: Session) -> None:
2930
@session
3031
def test_suite(session: Session) -> None:
3132
install_requirements(session, "test-env")
33+
session.install(".")
3234
session.run("pytest", "tests")
3335

3436

37+
@session
38+
def test_coverage(session: Session) -> None:
39+
install_requirements(session, "test-env")
40+
session.install("-e", ".")
41+
session.run("pytest", "tests", "--cov=flake8_idom_hooks", "--cov-report=term")
42+
43+
3544
def install_requirements(session: Session, name: str) -> None:
3645
session.install("-r", str(REQUIREMENTS_DIR / f"{name}.txt"))

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ exclude_lines =
2626
[tool:pytest]
2727
testpaths = tests
2828
xfail_strict = True
29-
addopts = --cov=flake8_idom_hooks --cov-report term

tests/test_flake8_idom_hooks.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33

44
from flake8.options.manager import OptionManager
55

6-
from flake8_idom_hooks import Plugin
6+
import flake8_idom_hooks
77

8-
options_manager = OptionManager("test", "0.0.0")
9-
Plugin.add_options(options_manager)
8+
options_manager = OptionManager(
9+
version="0.0.0",
10+
plugin_versions=flake8_idom_hooks.__version__,
11+
parents=[],
12+
)
13+
flake8_idom_hooks.Plugin.add_options(options_manager)
1014

1115

1216
def test_flake8_idom_hooks():
@@ -24,9 +28,11 @@ def test_flake8_idom_hooks():
2428
lineno = index + 2 # use 2 since error should be on next line
2529
col_offset = len(line) - len(lstrip_line)
2630
message = line.replace("# error:", "", 1).strip()
27-
expected_errors.add((lineno, col_offset, message, Plugin))
31+
expected_errors.add(
32+
(lineno, col_offset, message, flake8_idom_hooks.Plugin)
33+
)
2834

29-
options, filenames = options_manager.parse_args(["--exhaustive-hook-deps"])
30-
Plugin.parse_options(options)
35+
options = options_manager.parse_args(["--exhaustive-hook-deps"])
36+
flake8_idom_hooks.Plugin.parse_options(options)
3137

32-
assert set(Plugin(tree).run()) == expected_errors
38+
assert set(flake8_idom_hooks.Plugin(tree).run()) == expected_errors

0 commit comments

Comments
 (0)