1+ """Test config file searching for tmuxp."""
12import argparse
23import pathlib
34import typing as t
@@ -75,12 +76,14 @@ def test_get_configs_cwd(
7576 ],
7677)
7778def test_is_pure_name (path : str , expect : bool ) -> None :
79+ """Test is_pure_name() is truthy when file, not directory or config alias."""
7880 assert is_pure_name (path ) == expect
7981
8082
8183def test_tmuxp_configdir_env_var (
8284 tmp_path : pathlib .Path , monkeypatch : pytest .MonkeyPatch
8385) -> None :
86+ """Tests get_workspace_dir() when TMUXP_CONFIGDIR is set."""
8487 monkeypatch .setenv ("TMUXP_CONFIGDIR" , str (tmp_path ))
8588
8689 assert get_workspace_dir () == str (tmp_path )
@@ -89,6 +92,7 @@ def test_tmuxp_configdir_env_var(
8992def test_tmuxp_configdir_xdg_config_dir (
9093 tmp_path : pathlib .Path , monkeypatch : pytest .MonkeyPatch
9194) -> None :
95+ """Test get_workspace_dir() when XDG_CONFIG_HOME is set."""
9296 monkeypatch .setenv ("XDG_CONFIG_HOME" , str (tmp_path ))
9397 tmux_dir = tmp_path / "tmuxp"
9498 tmux_dir .mkdir ()
@@ -98,20 +102,23 @@ def test_tmuxp_configdir_xdg_config_dir(
98102
99103@pytest .fixture
100104def homedir (tmp_path : pathlib .Path ) -> pathlib .Path :
105+ """Fixture to ensure and return a home directory."""
101106 home = tmp_path / "home"
102107 home .mkdir ()
103108 return home
104109
105110
106111@pytest .fixture
107112def configdir (homedir : pathlib .Path ) -> pathlib .Path :
113+ """Fixture to ensure user directory for tmuxp and return it, via homedir fixture."""
108114 conf = homedir / ".tmuxp"
109115 conf .mkdir ()
110116 return conf
111117
112118
113119@pytest .fixture
114120def projectdir (homedir : pathlib .Path ) -> pathlib .Path :
121+ """Fixture to ensure and return an example project dir."""
115122 proj = homedir / "work" / "project"
116123 proj .mkdir (parents = True )
117124 return proj
@@ -124,6 +131,7 @@ def test_resolve_dot(
124131 projectdir : pathlib .Path ,
125132 monkeypatch : pytest .MonkeyPatch ,
126133) -> None :
134+ """Test find_workspace_file() resolves dots as relative / current directory."""
127135 monkeypatch .setenv ("HOME" , str (homedir ))
128136 monkeypatch .setenv ("XDG_CONFIG_HOME" , str (homedir / ".config" ))
129137
@@ -239,6 +247,7 @@ def test_find_workspace_file_arg(
239247 monkeypatch : pytest .MonkeyPatch ,
240248 capsys : pytest .CaptureFixture [str ],
241249) -> None :
250+ """Test find_workspace_file() via file path."""
242251 parser = argparse .ArgumentParser ()
243252 parser .add_argument ("workspace_file" , type = str )
244253
0 commit comments