move temporary directory to .direnv
This commit is contained in:
@@ -4,19 +4,17 @@ from pathlib import Path
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
TEST_ROOT = Path(__file__).parent.resolve()
|
TEST_ROOT = Path(__file__).parent.resolve()
|
||||||
PROJECT_ROOT = TEST_ROOT.parent
|
PROJECT_ROOT = TEST_ROOT.parent.parent.parent
|
||||||
|
if CLAN_CORE_ := os.environ.get("CLAN_CORE"):
|
||||||
CLAN_CORE_ = os.environ.get("CLAN_CORE")
|
|
||||||
if CLAN_CORE_:
|
|
||||||
CLAN_CORE = Path(CLAN_CORE_)
|
CLAN_CORE = Path(CLAN_CORE_)
|
||||||
else:
|
else:
|
||||||
CLAN_CORE = PROJECT_ROOT.parent.parent
|
CLAN_CORE = PROJECT_ROOT
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def project_root() -> Path:
|
def project_root() -> Path:
|
||||||
"""
|
"""
|
||||||
Root directory the clan-cli
|
Root directory the clan-core
|
||||||
"""
|
"""
|
||||||
return PROJECT_ROOT
|
return PROJECT_ROOT
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,11 @@ class SshdConfig:
|
|||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def sshd_config(project_root: Path, test_root: Path) -> Iterator[SshdConfig]:
|
def sshd_config(project_root: Path, test_root: Path) -> Iterator[SshdConfig]:
|
||||||
# FIXME, if any parent of `project_root` is world-writable than sshd will refuse it.
|
# FIXME, if any parent of the sshd directory is world-writable than sshd will refuse it.
|
||||||
with TemporaryDirectory(dir=project_root) as _dir:
|
# we use .direnv instead since it's already in .gitignore
|
||||||
|
direnv = project_root / ".direnv"
|
||||||
|
direnv.mkdir(exist_ok=True)
|
||||||
|
with TemporaryDirectory(dir=direnv) as _dir:
|
||||||
dir = Path(_dir)
|
dir = Path(_dir)
|
||||||
host_key = dir / "host_ssh_host_ed25519_key"
|
host_key = dir / "host_ssh_host_ed25519_key"
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
|
|||||||
Reference in New Issue
Block a user