Skip to content

Commit 3dce27d

Browse files
committed
style: configure ruff to check tests/
1 parent b0e901e commit 3dce27d

20 files changed

+86
-41
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ generate = "python scripts/generate.py"
3131
format = "ruff format ."
3232
isort = "ruff check --select I . --fix"
3333
mypy = "mypy ."
34-
ruff = "ruff check src"
34+
ruff = "ruff check src tests --extend-exclude tests/models"
3535
safety = "poetry export -f requirements.txt | safety check --bare --stdin"
3636
test = "pytest tests"
3737
check = "task isort && task format && task mypy && task ruff && task test && task safety"

tests/config/test_config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
from __future__ import annotations
22

33
import argparse
4-
from pathlib import Path
5-
from typing import MutableMapping
4+
from typing import TYPE_CHECKING, MutableMapping
65

76
import pytest
87

98
from binarylane.config import DefaultConfig, OptionName, UserConfig
109
from binarylane.config.sources import CommandlineSource, DefaultSource, EnvironmentSource, FileSource
1110

11+
if TYPE_CHECKING:
12+
from pathlib import Path
13+
1214

1315
def test_default_values() -> None:
1416
config = DefaultConfig()

tests/config/test_repository.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
from __future__ import annotations
22

33
from argparse import Namespace
4-
from pathlib import Path
5-
from typing import MutableMapping, Optional
4+
from typing import TYPE_CHECKING, MutableMapping, Optional
65

76
import pytest
87

98
from binarylane.config import OptionName, Repository
109
from binarylane.config.sources import CommandlineSource, DefaultSource, EnvironmentSource, FileSource, RuntimeSource
1110

11+
if TYPE_CHECKING:
12+
from pathlib import Path
13+
1214

1315
def test_init_default_source() -> None:
1416
repo = Repository()

tests/config/test_sources.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
from __future__ import annotations
22

33
import argparse
4-
from pathlib import Path
5-
from typing import MutableMapping
4+
from typing import TYPE_CHECKING, MutableMapping
65

76
from binarylane.config import OptionName
87
from binarylane.config.sources import CommandlineSource, DefaultSource, EnvironmentSource, FileSource, RuntimeSource
98

9+
if TYPE_CHECKING:
10+
from pathlib import Path
11+
1012

1113
def test_commandline_get() -> None:
1214
parser = argparse.ArgumentParser()

tests/integration/conftest.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
from __future__ import annotations
22

3+
from typing import TYPE_CHECKING
4+
35
import pytest
46

57
from binarylane.console.app import App
6-
from binarylane.console.runners import Context
8+
9+
if TYPE_CHECKING:
10+
from binarylane.console.runners import Context
711

812

913
class AppWithContext(App):

tests/integration/test_app.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
from __future__ import annotations
22

3+
from typing import TYPE_CHECKING
4+
35
import pytest
4-
from _pytest.capture import CaptureFixture
56

6-
from tests.integration.conftest import App, AppWithContext
7+
if TYPE_CHECKING:
8+
from _pytest.capture import CaptureFixture
9+
10+
from tests.integration.conftest import App, AppWithContext
711

812

913
def test_app_program_name(app: App, capsys: CaptureFixture[str]) -> None:

tests/integration/test_curl.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
from __future__ import annotations
22

3-
from _pytest.capture import CaptureFixture
3+
from typing import TYPE_CHECKING
44

55
from tests.runner import TypeRunner
66

77
from binarylane.console.commands.api import get_v2_sizes as size_list
88
from binarylane.console.runners.command import CommandRunner
99

10+
if TYPE_CHECKING:
11+
from _pytest.capture import CaptureFixture
12+
1013

1114
def test_curl_size_list(capsys: CaptureFixture[str]) -> None:
1215
runner = TypeRunner[CommandRunner](size_list.Command)

tests/integration/test_help.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
from __future__ import annotations
22

3+
from typing import TYPE_CHECKING
4+
35
import pytest
46
from pytest import CaptureFixture
57

6-
from tests.integration.conftest import App
7-
88
from binarylane.console.metadata import program_description
99

10+
if TYPE_CHECKING:
11+
from tests.integration.conftest import App
12+
1013

1114
def test_app_root_help(app: App, capsys: CaptureFixture[str]) -> None:
1215
with pytest.raises(SystemExit):

tests/integration/test_list.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
from __future__ import annotations
22

3+
from typing import TYPE_CHECKING
4+
35
import pytest
4-
from _pytest.capture import CaptureFixture
56

67
from tests.runner import TypeRunner
78

89
from binarylane.console.commands.api import get_v2_sizes as size_list
910
from binarylane.console.runners.command import CommandRunner
1011

12+
if TYPE_CHECKING:
13+
from _pytest.capture import CaptureFixture
14+
1115

1216
def test_list_invalid_format_value(capsys: CaptureFixture[str]) -> None:
1317
runner = TypeRunner[CommandRunner](size_list.Command)

tests/integration/test_output_json.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from __future__ import annotations
22

3+
from typing import TYPE_CHECKING
4+
35
import pytest
4-
from _pytest.capture import CaptureFixture
56

67
from binarylane.models.meta import Meta
78
from binarylane.models.route_entry import RouteEntry
@@ -13,6 +14,9 @@
1314
from binarylane.console.runners.command import CommandRunner
1415
from binarylane.console.runners.list import ListRunner
1516

17+
if TYPE_CHECKING:
18+
from _pytest.capture import CaptureFixture
19+
1620

1721
@pytest.fixture
1822
def vpc() -> Vpc:

0 commit comments

Comments
 (0)