diff --git a/pkgs/clan-app/tests/wayland.py b/pkgs/clan-app/tests/wayland.py index a5607e945..2e96688a5 100644 --- a/pkgs/clan-app/tests/wayland.py +++ b/pkgs/clan-app/tests/wayland.py @@ -19,7 +19,7 @@ def wayland_compositor() -> Generator[Popen, None, None]: GtkProc = NewType("GtkProc", Popen) -@pytest.fixture(scope="function") +@pytest.fixture def app() -> Generator[GtkProc, None, None]: rapp = Popen([sys.executable, "-m", "clan_app"], text=True) yield GtkProc(rapp) diff --git a/pkgs/clan-cli/tests/fixtures_flakes.py b/pkgs/clan-cli/tests/fixtures_flakes.py index 05b8d39f8..1613c5672 100644 --- a/pkgs/clan-cli/tests/fixtures_flakes.py +++ b/pkgs/clan-cli/tests/fixtures_flakes.py @@ -246,7 +246,7 @@ def test_flake_with_core( @pytest.fixture def test_local_democlan( monkeypatch: pytest.MonkeyPatch, temporary_home: Path -) -> Iterator[FlakeForTest]: +) -> FlakeForTest: democlan = os.getenv(key="DEMOCLAN_ROOT") if democlan is None: msg = ( @@ -258,7 +258,7 @@ def test_local_democlan( msg = f"DEMOCLAN_ROOT ({democlan_p}) is not a directory. This test requires the democlan directory to be present" raise Exception(msg) - yield FlakeForTest(democlan_p) + return FlakeForTest(democlan_p) @pytest.fixture diff --git a/pkgs/clan-cli/tests/stdout.py b/pkgs/clan-cli/tests/stdout.py index eeffbfaa9..8d460c9c0 100644 --- a/pkgs/clan-cli/tests/stdout.py +++ b/pkgs/clan-cli/tests/stdout.py @@ -1,11 +1,10 @@ import types import pytest -from pytest import CaptureFixture class CaptureOutput: - def __init__(self, capsys: CaptureFixture) -> None: + def __init__(self, capsys: pytest.CaptureFixture) -> None: self.capsys = capsys self.capsys_disabled = capsys.disabled() self.capsys_disabled.__enter__() @@ -31,5 +30,5 @@ class CaptureOutput: @pytest.fixture -def capture_output(capsys: CaptureFixture) -> CaptureOutput: +def capture_output(capsys: pytest.CaptureFixture) -> CaptureOutput: return CaptureOutput(capsys) diff --git a/pkgs/clan-cli/tests/test_config.py b/pkgs/clan-cli/tests/test_config.py index 6af9aaddb..eba6bd7b6 100644 --- a/pkgs/clan-cli/tests/test_config.py +++ b/pkgs/clan-cli/tests/test_config.py @@ -143,7 +143,7 @@ def test_cast() -> None: @pytest.mark.parametrize( - "option,value,options,expected", + ("option", "value", "options", "expected"), [ ("foo.bar", ["baz"], {"foo.bar": {"type": "str"}}, ("foo.bar", ["baz"])), ("foo.bar", ["baz"], {"foo": {"type": "attrs"}}, ("foo", {"bar": ["baz"]})), diff --git a/pkgs/clan-cli/tests/test_git.py b/pkgs/clan-cli/tests/test_git.py index 9f3f57642..6ede4268b 100644 --- a/pkgs/clan-cli/tests/test_git.py +++ b/pkgs/clan-cli/tests/test_git.py @@ -28,11 +28,10 @@ def test_commit_file(git_repo: Path) -> None: def test_commit_file_outside_git_raises_error(git_repo: Path) -> None: # create a file outside the git (a temporary file) with tempfile.NamedTemporaryFile() as tmp: - # commit the file + + # this should not fail but skip the commit with pytest.raises(ClanError): git.commit_file(Path(tmp.name), git_repo, "test commit") - # this should not fail but skip the commit - git.commit_file(Path(tmp.name), git_repo, "test commit") def test_commit_file_not_existing_raises_error(git_repo: Path) -> None: diff --git a/pkgs/clan-cli/tests/test_secrets_cli.py b/pkgs/clan-cli/tests/test_secrets_cli.py index 2bc485e30..debc26eae 100644 --- a/pkgs/clan-cli/tests/test_secrets_cli.py +++ b/pkgs/clan-cli/tests/test_secrets_cli.py @@ -496,7 +496,7 @@ def test_secrets( # user2 is not in the group anymore with capture_output as output: cli.run(["secrets", "get", "--flake", str(test_flake.path), "key"]) - print(output.out) + print(output.out) cli.run( [ diff --git a/pkgs/clan-vm-manager/tests/wayland.py b/pkgs/clan-vm-manager/tests/wayland.py index 1156b666d..d2515ba86 100644 --- a/pkgs/clan-vm-manager/tests/wayland.py +++ b/pkgs/clan-vm-manager/tests/wayland.py @@ -19,7 +19,7 @@ def wayland_compositor() -> Generator[Popen, None, None]: GtkProc = NewType("GtkProc", Popen) -@pytest.fixture(scope="function") +@pytest.fixture def app() -> Generator[GtkProc, None, None]: rapp = Popen([sys.executable, "-m", "clan_vm_manager"], text=True) yield GtkProc(rapp) diff --git a/pyproject.toml b/pyproject.toml index ec0393013..08141049c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,7 @@ lint.select = [ "LOG", "N", "PIE", + "PT", "PYI", "RUF", "T10",