From d41cca2e2874c828fbf92464307f34188722615b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 15 Sep 2023 16:34:16 +0200 Subject: [PATCH] add clan_core path helper function --- pkgs/clan-cli/tests/root.py | 11 ++++++++++- pkgs/clan-cli/tests/test_flake.py | 7 +++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/pkgs/clan-cli/tests/root.py b/pkgs/clan-cli/tests/root.py index c881ce026..0105e82a8 100644 --- a/pkgs/clan-cli/tests/root.py +++ b/pkgs/clan-cli/tests/root.py @@ -4,12 +4,13 @@ import pytest TEST_ROOT = Path(__file__).parent.resolve() PROJECT_ROOT = TEST_ROOT.parent +CLAN_CORE = PROJECT_ROOT.parent.parent @pytest.fixture(scope="session") def project_root() -> Path: """ - Root directory of the tests + Root directory the clan-cli """ return PROJECT_ROOT @@ -20,3 +21,11 @@ def test_root() -> Path: Root directory of the tests """ return TEST_ROOT + + +@pytest.fixture(scope="session") +def clan_core() -> Path: + """ + Directory of the clan-core flake + """ + return CLAN_CORE diff --git a/pkgs/clan-cli/tests/test_flake.py b/pkgs/clan-cli/tests/test_flake.py index cff8caf75..66083b19c 100644 --- a/pkgs/clan-cli/tests/test_flake.py +++ b/pkgs/clan-cli/tests/test_flake.py @@ -5,7 +5,7 @@ from pathlib import Path from typing import Iterator import pytest -from root import PROJECT_ROOT +from root import CLAN_CORE from clan_cli.dirs import nixpkgs_source @@ -46,9 +46,8 @@ def test_flake(monkeymodule: pytest.MonkeyPatch) -> Iterator[Path]: @pytest.fixture(scope="module") def test_flake_with_core(monkeymodule: pytest.MonkeyPatch) -> Iterator[Path]: - clan_core_flake = PROJECT_ROOT.parent.parent - if not (clan_core_flake / "flake.nix").exists(): + if not (CLAN_CORE / "flake.nix").exists(): raise Exception( "clan-core flake not found. This test requires the clan-core flake to be present" ) - yield from create_flake(monkeymodule, "test_flake_with_core", clan_core_flake) + yield from create_flake(monkeymodule, "test_flake_with_core", CLAN_CORE)