Skip to content

Commit

Permalink
Update checkout_is_dirty tests
Browse files Browse the repository at this point in the history
  • Loading branch information
simu committed Feb 14, 2025
1 parent 61c3d04 commit 596d710
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,30 @@ def test_checkout_is_dirty(tmp_path: P, config: Config):

assert not c.checkout_is_dirty()

with open(c.target_dir / "README.md", "a", encoding="utf-8") as f:
f.writelines(["", "change"])

assert c.checkout_is_dirty()


def test_alias_checkout_is_dirty(tmp_path: P, config: Config):
rem = _setup_existing_component(tmp_path, worktree=False)
clone_url = f"file://{rem.common_dir}"

c = Component.clone(config, clone_url, "test-component")

c.register_alias("test-alias", c.version, c.dependency)
c.checkout_alias("test-alias")

assert not c.alias_checkout_is_dirty("test-alias")

with open(
c.alias_directory("test-alias") / "README.md", "a", encoding="utf-8"
) as f:
f.writelines(["", "change"])

assert c.alias_checkout_is_dirty("test-alias")


@pytest.mark.parametrize("workdir", [True, False])
def test_component_register_alias_workdir(tmp_path: P, workdir: bool):
Expand Down

0 comments on commit 596d710

Please sign in to comment.