You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make the TestCli Tests Independent of the Working Directory #2861
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.
Activity
Isolate TestCli From the Working Directory and Test the Absolute-Path…