Skip to content

Commit

Permalink
tests(workspace[config]): Note pydocstyle updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Dec 17, 2023
1 parent b4df9f8 commit 77c95c7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/workspace/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@


def load_workspace(path: t.Union[str, pathlib.Path]) -> t.Dict[str, t.Any]:
"""Load tmuxp workspace configuration from file."""
return ConfigReader._from_file(
pathlib.Path(path) if isinstance(path, str) else path
)
Expand All @@ -23,6 +24,7 @@ def load_workspace(path: t.Union[str, pathlib.Path]) -> t.Dict[str, t.Any]:
def test_export_json(
tmp_path: pathlib.Path, config_fixture: "WorkspaceTestData"
) -> None:
"""Test exporting configuration dictionary to JSON."""
json_workspace_file = tmp_path / "config.json"

configparser = ConfigReader(config_fixture.sample_workspace.sample_workspace_dict)
Expand Down Expand Up @@ -94,6 +96,7 @@ def test_workspace_expand2(config_fixture: "WorkspaceTestData") -> None:


def test_inheritance_workspace() -> None:
"""TODO: Create a test to verify workspace config inheritance to object tree."""
workspace = inheritance_workspace_before

# TODO: Look at verifying window_start_directory
Expand Down Expand Up @@ -133,6 +136,7 @@ def test_shell_command_before(config_fixture: "WorkspaceTestData") -> None:


def test_in_session_scope(config_fixture: "WorkspaceTestData") -> None:
"""Verify shell_command before_session is in session scope."""
sconfig = ConfigReader._load(
format="yaml", content=config_fixture.shell_command_before_session.before
)
Expand All @@ -146,11 +150,13 @@ def test_in_session_scope(config_fixture: "WorkspaceTestData") -> None:


def test_trickle_relative_start_directory(config_fixture: "WorkspaceTestData") -> None:
"""Verify tmuxp config proliferates relative start directory to descendants."""
test_workspace = loader.trickle(config_fixture.trickle.before)
assert test_workspace == config_fixture.trickle.expected


def test_trickle_window_with_no_pane_workspace() -> None:
"""Verify tmuxp window config automatically infers a single pane."""
test_yaml = """
session_name: test_session
windows:
Expand Down Expand Up @@ -201,6 +207,7 @@ def test_expands_blank_panes(config_fixture: "WorkspaceTestData") -> None:


def test_no_session_name() -> None:
"""Verify exception raised when tmuxp configuration has no session name."""
yaml_workspace = """
- window_name: editor
panes:
Expand All @@ -222,6 +229,7 @@ def test_no_session_name() -> None:


def test_no_windows() -> None:
"""Verify exception raised when tmuxp configuration has no windows."""
yaml_workspace = """
session_name: test session
"""
Expand All @@ -234,6 +242,7 @@ def test_no_windows() -> None:


def test_no_window_name() -> None:
"""Verify exception raised when tmuxp config missing window name."""
yaml_workspace = """
session_name: test session
windows:
Expand All @@ -256,6 +265,7 @@ def test_no_window_name() -> None:


def test_replaces_env_variables(monkeypatch: pytest.MonkeyPatch) -> None:
"""Test loading configuration resolves environmental variables."""
env_key = "TESTHEY92"
env_val = "HEYO1"
yaml_workspace = """
Expand Down Expand Up @@ -296,7 +306,8 @@ def test_replaces_env_variables(monkeypatch: pytest.MonkeyPatch) -> None:
assert "logging @ %s" % env_val == sconfig["windows"][1]["window_name"]


def test_plugins() -> None:
def test_validate_plugins() -> None:
"""Test validation of plugins loading via tmuxp configuration file."""
yaml_workspace = """
session_name: test session
plugins: tmuxp-plugin-one.plugin.TestPluginOne
Expand Down

0 comments on commit 77c95c7

Please sign in to comment.