Skip to content

Commit 9b2fd31

Browse files
committed
test fixtures: Add tmuxp configdir
1 parent 73ffddc commit 9b2fd31

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

conftest.py

+19
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
from libtmux.test import namer
1717
from tests.fixtures import utils as test_utils
18+
from tmuxp.cli.utils import get_config_dir
1819

1920
if t.TYPE_CHECKING:
2021
from libtmux.session import Session
@@ -40,6 +41,24 @@ def home_path_default(monkeypatch: pytest.MonkeyPatch, user_path: pathlib.Path)
4041
monkeypatch.setenv("HOME", str(user_path))
4142

4243

44+
@pytest.fixture
45+
def tmuxp_configdir(user_path: pathlib.Path) -> pathlib.Path:
46+
xdg_config_dir = user_path / ".config"
47+
xdg_config_dir.mkdir(exist_ok=True)
48+
49+
tmuxp_configdir = xdg_config_dir / "tmuxp"
50+
tmuxp_configdir.mkdir(exist_ok=True)
51+
return tmuxp_configdir
52+
53+
54+
@pytest.fixture
55+
def tmuxp_configdir_default(
56+
monkeypatch: pytest.MonkeyPatch, tmuxp_configdir: pathlib.Path
57+
) -> None:
58+
monkeypatch.setenv("TMUXP_CONFIGDIR", str(tmuxp_configdir))
59+
assert get_config_dir() == str(tmuxp_configdir)
60+
61+
4362
@pytest.fixture(scope="function")
4463
def monkeypatch_plugin_test_packages(monkeypatch: pytest.MonkeyPatch) -> None:
4564
paths = [

0 commit comments

Comments
 (0)