Skip to content

Make the TestCli Tests Independent of the Working Directory #2861

Closed

Description

@ptr727

Found while reviewing the fix for #2830. Several TestCli tests in tests/test_prose_lint.py depend on the working directory when it is an ancestor of the test's temporary directory (for example a run started from the parent of the system temp root).

Repro: run the TestCli class from /tmp with python3 -m unittest discover -s <checkout>/tests -p test_prose_lint.py -k TestCli. About 19 tests fail, among them test_diff_scope_reports_only_the_changed_lines (1 != 2) and test_a_long_unparsed_list_is_cut_to_five_names (paths print relative to the working directory instead of absolute). Runs from the repository root pass.

Fix shape: have those tests run under contextlib.chdir into a directory that is not an ancestor of their fixtures, or compare against the cwd-relative form.

🤖 Generated with Claude Code

Activity

  1. added a commit that references this issue on Oct 12, 2026
    f39d182
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions