1
1
"""Test for tmuxp configuration import, inlining, expanding and export."""
2
2
import os
3
3
import pathlib
4
+ import typing
4
5
from typing import Union
5
6
6
7
import pytest
11
12
12
13
from . import EXAMPLE_PATH
13
14
15
+ if typing .TYPE_CHECKING :
16
+ from .fixtures import config as ConfigFixture
17
+
14
18
15
19
@pytest .fixture
16
20
def config_fixture ():
@@ -40,7 +44,7 @@ def load_config(path: Union[str, pathlib.Path]) -> str:
40
44
)
41
45
42
46
43
- def test_export_json (tmp_path : pathlib .Path , config_fixture ):
47
+ def test_export_json (tmp_path : pathlib .Path , config_fixture : "ConfigFixture" ):
44
48
json_config_file = tmp_path / "config.json"
45
49
46
50
configparser = kaptan .Kaptan ()
@@ -55,7 +59,7 @@ def test_export_json(tmp_path: pathlib.Path, config_fixture):
55
59
assert config_fixture .sampleconfig .sampleconfigdict == new_config_data
56
60
57
61
58
- def test_export_yaml (tmp_path : pathlib .Path , config_fixture ):
62
+ def test_export_yaml (tmp_path : pathlib .Path , config_fixture : "ConfigFixture" ):
59
63
yaml_config_file = tmp_path / "config.yaml"
60
64
61
65
configparser = kaptan .Kaptan ()
@@ -99,13 +103,13 @@ def test_scan_config(tmp_path: pathlib.Path):
99
103
assert len (configs ) == files
100
104
101
105
102
- def test_config_expand1 (config_fixture ):
106
+ def test_config_expand1 (config_fixture : "ConfigFixture" ):
103
107
"""Expand shell commands from string to list."""
104
108
test_config = config .expand (config_fixture .expand1 .before_config )
105
109
assert test_config == config_fixture .expand1 .after_config
106
110
107
111
108
- def test_config_expand2 (config_fixture ):
112
+ def test_config_expand2 (config_fixture : "ConfigFixture" ):
109
113
"""Expand shell commands from string to list."""
110
114
unexpanded_dict = load_yaml (config_fixture .expand2 .unexpanded_yaml )
111
115
expanded_dict = load_yaml (config_fixture .expand2 .expanded_yaml )
@@ -224,7 +228,7 @@ def test_inheritance_config():
224
228
assert config == inheritance_config_after
225
229
226
230
227
- def test_shell_command_before (config_fixture ):
231
+ def test_shell_command_before (config_fixture : "ConfigFixture" ):
228
232
"""Config inheritance for the nested 'start_command'."""
229
233
test_config = config_fixture .shell_command_before .config_unexpanded
230
234
test_config = config .expand (test_config )
@@ -235,7 +239,7 @@ def test_shell_command_before(config_fixture):
235
239
assert test_config == config_fixture .shell_command_before .config_after
236
240
237
241
238
- def test_in_session_scope (config_fixture ):
242
+ def test_in_session_scope (config_fixture : "ConfigFixture" ):
239
243
sconfig = load_yaml (config_fixture .shell_command_before_session .before )
240
244
241
245
config .validate_schema (sconfig )
@@ -246,7 +250,7 @@ def test_in_session_scope(config_fixture):
246
250
)
247
251
248
252
249
- def test_trickle_relative_start_directory (config_fixture ):
253
+ def test_trickle_relative_start_directory (config_fixture : "ConfigFixture" ):
250
254
test_config = config .trickle (config_fixture .trickle .before )
251
255
assert test_config == config_fixture .trickle .expected
252
256
@@ -269,7 +273,7 @@ def test_trickle_window_with_no_pane_config():
269
273
}
270
274
271
275
272
- def test_expands_blank_panes (config_fixture ):
276
+ def test_expands_blank_panes (config_fixture : "ConfigFixture" ):
273
277
"""Expand blank config into full form.
274
278
275
279
Handle ``NoneType`` and 'blank'::
0 commit comments