Skip to content

Make the clean tests capable of failing #24

Description

@arecarn

What to build

tests/test_clean.py currently passes whether or not clean does anything, so it cannot detect a regression or a no-op. After this ticket the tests assert on what actually changed on disk, and any test that does not yet pass is marked xfail so CI stays green while the gap is recorded.

Every assertion in the file is of the form:

dploy.clean([source_a], dest)
assert not os.path.exists(dest_path)

os.path.exists() follows the symlink and reports False for a link whose target is missing — which is the definition of a dangling link. The assertion is therefore already true before clean runs, and stays true if clean does nothing at all. test_clean_after_stow_not_removing_invalid_link_from_other_source has the mirror-image problem: it asserts that nothing happened, which also passes trivially.

The honest check is os.path.islink(), which reports whether the link is still there regardless of whether its target resolves.

Verified by probe: with the assertions switched to islink(), all three tests fail — clean removes nothing. That is the subject of the follow-up ticket, not this one. This ticket only makes the failure visible.

Acceptance criteria

  • Every assertion about a link's removal uses os.path.islink(), not os.path.exists()
  • The test that asserts a link is preserved distinguishes "still a link" from "target missing", so it cannot pass by accident
  • Tests that do not yet pass are marked xfail referencing the follow-up ticket, and the suite is green
  • No changes to anything under dploy/

Blocked by

None — can start immediately.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions