This commit is contained in:
Jörg Thalheim
2024-09-02 15:47:17 +02:00
parent 078cab47bf
commit ddab0a66c8
8 changed files with 11 additions and 12 deletions

View File

@@ -19,7 +19,7 @@ def wayland_compositor() -> Generator[Popen, None, None]:
GtkProc = NewType("GtkProc", Popen) GtkProc = NewType("GtkProc", Popen)
@pytest.fixture(scope="function") @pytest.fixture
def app() -> Generator[GtkProc, None, None]: def app() -> Generator[GtkProc, None, None]:
rapp = Popen([sys.executable, "-m", "clan_app"], text=True) rapp = Popen([sys.executable, "-m", "clan_app"], text=True)
yield GtkProc(rapp) yield GtkProc(rapp)

View File

@@ -246,7 +246,7 @@ def test_flake_with_core(
@pytest.fixture @pytest.fixture
def test_local_democlan( def test_local_democlan(
monkeypatch: pytest.MonkeyPatch, temporary_home: Path monkeypatch: pytest.MonkeyPatch, temporary_home: Path
) -> Iterator[FlakeForTest]: ) -> FlakeForTest:
democlan = os.getenv(key="DEMOCLAN_ROOT") democlan = os.getenv(key="DEMOCLAN_ROOT")
if democlan is None: if democlan is None:
msg = ( 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" msg = f"DEMOCLAN_ROOT ({democlan_p}) is not a directory. This test requires the democlan directory to be present"
raise Exception(msg) raise Exception(msg)
yield FlakeForTest(democlan_p) return FlakeForTest(democlan_p)
@pytest.fixture @pytest.fixture

View File

@@ -1,11 +1,10 @@
import types import types
import pytest import pytest
from pytest import CaptureFixture
class CaptureOutput: class CaptureOutput:
def __init__(self, capsys: CaptureFixture) -> None: def __init__(self, capsys: pytest.CaptureFixture) -> None:
self.capsys = capsys self.capsys = capsys
self.capsys_disabled = capsys.disabled() self.capsys_disabled = capsys.disabled()
self.capsys_disabled.__enter__() self.capsys_disabled.__enter__()
@@ -31,5 +30,5 @@ class CaptureOutput:
@pytest.fixture @pytest.fixture
def capture_output(capsys: CaptureFixture) -> CaptureOutput: def capture_output(capsys: pytest.CaptureFixture) -> CaptureOutput:
return CaptureOutput(capsys) return CaptureOutput(capsys)

View File

@@ -143,7 +143,7 @@ def test_cast() -> None:
@pytest.mark.parametrize( @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.bar": {"type": "str"}}, ("foo.bar", ["baz"])),
("foo.bar", ["baz"], {"foo": {"type": "attrs"}}, ("foo", {"bar": ["baz"]})), ("foo.bar", ["baz"], {"foo": {"type": "attrs"}}, ("foo", {"bar": ["baz"]})),

View File

@@ -28,10 +28,9 @@ def test_commit_file(git_repo: Path) -> None:
def test_commit_file_outside_git_raises_error(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) # create a file outside the git (a temporary file)
with tempfile.NamedTemporaryFile() as tmp: with tempfile.NamedTemporaryFile() as tmp:
# commit the file
with pytest.raises(ClanError):
git.commit_file(Path(tmp.name), git_repo, "test commit")
# this should not fail but skip the commit # this should not fail but skip the commit
with pytest.raises(ClanError):
git.commit_file(Path(tmp.name), git_repo, "test commit") git.commit_file(Path(tmp.name), git_repo, "test commit")

View File

@@ -19,7 +19,7 @@ def wayland_compositor() -> Generator[Popen, None, None]:
GtkProc = NewType("GtkProc", Popen) GtkProc = NewType("GtkProc", Popen)
@pytest.fixture(scope="function") @pytest.fixture
def app() -> Generator[GtkProc, None, None]: def app() -> Generator[GtkProc, None, None]:
rapp = Popen([sys.executable, "-m", "clan_vm_manager"], text=True) rapp = Popen([sys.executable, "-m", "clan_vm_manager"], text=True)
yield GtkProc(rapp) yield GtkProc(rapp)

View File

@@ -27,6 +27,7 @@ lint.select = [
"LOG", "LOG",
"N", "N",
"PIE", "PIE",
"PT",
"PYI", "PYI",
"RUF", "RUF",
"T10", "T10",