11"""Test for tmuxp configuration import, inlining, expanding and export."""
22import os
33import pathlib
4+ import types
45import typing
56from typing import Union
67
1314from .constants import EXAMPLE_PATH
1415
1516if typing .TYPE_CHECKING :
16- from .fixtures import config as ConfigFixture
17+ from .fixtures . structures import TestConfigData
1718
1819
1920@pytest .fixture
@@ -23,9 +24,16 @@ def config_fixture():
2324 pytest setup (conftest.py) patches os.environ["HOME"], delay execution of
2425 os.path.expanduser until here.
2526 """
26- from .fixtures import config as config_fixture
27-
28- return config_fixture
27+ from .fixtures import config as test_config_data
28+ from .fixtures .structures import TestConfigData
29+
30+ return TestConfigData (
31+ ** {
32+ k : v
33+ for k , v in test_config_data .__dict__ .items ()
34+ if isinstance (v , types .ModuleType )
35+ }
36+ )
2937
3038
3139def load_yaml (path : Union [str , pathlib .Path ]) -> str :
@@ -44,7 +52,7 @@ def load_config(path: Union[str, pathlib.Path]) -> str:
4452 )
4553
4654
47- def test_export_json (tmp_path : pathlib .Path , config_fixture : "ConfigFixture " ):
55+ def test_export_json (tmp_path : pathlib .Path , config_fixture : "TestConfigData " ):
4856 json_config_file = tmp_path / "config.json"
4957
5058 configparser = kaptan .Kaptan ()
@@ -59,7 +67,7 @@ def test_export_json(tmp_path: pathlib.Path, config_fixture: "ConfigFixture"):
5967 assert config_fixture .sampleconfig .sampleconfigdict == new_config_data
6068
6169
62- def test_export_yaml (tmp_path : pathlib .Path , config_fixture : "ConfigFixture " ):
70+ def test_export_yaml (tmp_path : pathlib .Path , config_fixture : "TestConfigData " ):
6371 yaml_config_file = tmp_path / "config.yaml"
6472
6573 configparser = kaptan .Kaptan ()
@@ -103,13 +111,13 @@ def test_scan_config(tmp_path: pathlib.Path):
103111 assert len (configs ) == files
104112
105113
106- def test_config_expand1 (config_fixture : "ConfigFixture " ):
114+ def test_config_expand1 (config_fixture : "TestConfigData " ):
107115 """Expand shell commands from string to list."""
108116 test_config = config .expand (config_fixture .expand1 .before_config )
109117 assert test_config == config_fixture .expand1 .after_config ()
110118
111119
112- def test_config_expand2 (config_fixture : "ConfigFixture " ):
120+ def test_config_expand2 (config_fixture : "TestConfigData " ):
113121 """Expand shell commands from string to list."""
114122 unexpanded_dict = load_yaml (config_fixture .expand2 .unexpanded_yaml ())
115123 expanded_dict = load_yaml (config_fixture .expand2 .expanded_yaml ())
@@ -228,7 +236,7 @@ def test_inheritance_config():
228236 assert config == inheritance_config_after
229237
230238
231- def test_shell_command_before (config_fixture : "ConfigFixture " ):
239+ def test_shell_command_before (config_fixture : "TestConfigData " ):
232240 """Config inheritance for the nested 'start_command'."""
233241 test_config = config_fixture .shell_command_before .config_unexpanded
234242 test_config = config .expand (test_config )
@@ -239,7 +247,7 @@ def test_shell_command_before(config_fixture: "ConfigFixture"):
239247 assert test_config == config_fixture .shell_command_before .config_after ()
240248
241249
242- def test_in_session_scope (config_fixture : "ConfigFixture " ):
250+ def test_in_session_scope (config_fixture : "TestConfigData " ):
243251 sconfig = load_yaml (config_fixture .shell_command_before_session .before )
244252
245253 config .validate_schema (sconfig )
@@ -250,7 +258,7 @@ def test_in_session_scope(config_fixture: "ConfigFixture"):
250258 )
251259
252260
253- def test_trickle_relative_start_directory (config_fixture : "ConfigFixture " ):
261+ def test_trickle_relative_start_directory (config_fixture : "TestConfigData " ):
254262 test_config = config .trickle (config_fixture .trickle .before )
255263 assert test_config == config_fixture .trickle .expected
256264
@@ -273,7 +281,7 @@ def test_trickle_window_with_no_pane_config():
273281 }
274282
275283
276- def test_expands_blank_panes (config_fixture : "ConfigFixture " ):
284+ def test_expands_blank_panes (config_fixture : "TestConfigData " ):
277285 """Expand blank config into full form.
278286
279287 Handle ``NoneType`` and 'blank'::
0 commit comments