Skip to content

Commit da01974

Browse files
committed
Type annotations for module
Raises an error in pyright, but completion works as expected. Potentially reach out to https://github.com/microsoft/pylance-release about this.
1 parent 45bf308 commit da01974

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

tests/test_config.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Test for tmuxp configuration import, inlining, expanding and export."""
22
import os
33
import pathlib
4+
import typing
45
from typing import Union
56

67
import pytest
@@ -11,6 +12,9 @@
1112

1213
from . import EXAMPLE_PATH
1314

15+
if typing.TYPE_CHECKING:
16+
from .fixtures import config as ConfigFixture
17+
1418

1519
@pytest.fixture
1620
def config_fixture():
@@ -40,7 +44,7 @@ def load_config(path: Union[str, pathlib.Path]) -> str:
4044
)
4145

4246

43-
def test_export_json(tmp_path: pathlib.Path, config_fixture):
47+
def test_export_json(tmp_path: pathlib.Path, config_fixture: "ConfigFixture"):
4448
json_config_file = tmp_path / "config.json"
4549

4650
configparser = kaptan.Kaptan()
@@ -55,7 +59,7 @@ def test_export_json(tmp_path: pathlib.Path, config_fixture):
5559
assert config_fixture.sampleconfig.sampleconfigdict == new_config_data
5660

5761

58-
def test_export_yaml(tmp_path: pathlib.Path, config_fixture):
62+
def test_export_yaml(tmp_path: pathlib.Path, config_fixture: "ConfigFixture"):
5963
yaml_config_file = tmp_path / "config.yaml"
6064

6165
configparser = kaptan.Kaptan()
@@ -99,13 +103,13 @@ def test_scan_config(tmp_path: pathlib.Path):
99103
assert len(configs) == files
100104

101105

102-
def test_config_expand1(config_fixture):
106+
def test_config_expand1(config_fixture: "ConfigFixture"):
103107
"""Expand shell commands from string to list."""
104108
test_config = config.expand(config_fixture.expand1.before_config)
105109
assert test_config == config_fixture.expand1.after_config
106110

107111

108-
def test_config_expand2(config_fixture):
112+
def test_config_expand2(config_fixture: "ConfigFixture"):
109113
"""Expand shell commands from string to list."""
110114
unexpanded_dict = load_yaml(config_fixture.expand2.unexpanded_yaml)
111115
expanded_dict = load_yaml(config_fixture.expand2.expanded_yaml)
@@ -224,7 +228,7 @@ def test_inheritance_config():
224228
assert config == inheritance_config_after
225229

226230

227-
def test_shell_command_before(config_fixture):
231+
def test_shell_command_before(config_fixture: "ConfigFixture"):
228232
"""Config inheritance for the nested 'start_command'."""
229233
test_config = config_fixture.shell_command_before.config_unexpanded
230234
test_config = config.expand(test_config)
@@ -235,7 +239,7 @@ def test_shell_command_before(config_fixture):
235239
assert test_config == config_fixture.shell_command_before.config_after
236240

237241

238-
def test_in_session_scope(config_fixture):
242+
def test_in_session_scope(config_fixture: "ConfigFixture"):
239243
sconfig = load_yaml(config_fixture.shell_command_before_session.before)
240244

241245
config.validate_schema(sconfig)
@@ -246,7 +250,7 @@ def test_in_session_scope(config_fixture):
246250
)
247251

248252

249-
def test_trickle_relative_start_directory(config_fixture):
253+
def test_trickle_relative_start_directory(config_fixture: "ConfigFixture"):
250254
test_config = config.trickle(config_fixture.trickle.before)
251255
assert test_config == config_fixture.trickle.expected
252256

@@ -269,7 +273,7 @@ def test_trickle_window_with_no_pane_config():
269273
}
270274

271275

272-
def test_expands_blank_panes(config_fixture):
276+
def test_expands_blank_panes(config_fixture: "ConfigFixture"):
273277
"""Expand blank config into full form.
274278
275279
Handle ``NoneType`` and 'blank'::

0 commit comments

Comments
 (0)