Skip to content

Commit

Permalink
tests: Accommodate workdir test being run near filesystem root
Browse files Browse the repository at this point in the history
  • Loading branch information
blairconrad authored and pawamoy committed Oct 16, 2024
1 parent a92436a commit 8fc381f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,8 @@ def test_workdir_as_context_manager(monkeypatch: pytest.MonkeyPatch) -> None:
records.append(failure.value.code)

base = records[0]
assert records == [base, base - 1, base - 2, base - 3]

# If the repository is checked out near the root of the filesystem, the working directory will
# eventually be the root, so cap the lowest depth at 1.
expected_depths = [max(1, base - offset) for offset in range(len(records))]
assert records == expected_depths

0 comments on commit 8fc381f

Please sign in to comment.