Fix: test_auth.py line-prefix corruption & _resolve_output_path default-dir bug #3

Closed
opened 2026-05-21 22:11:55 +00:00 by shawn · 0 comments
Owner

Problems

  1. test_auth.py corrupted: Every line had a duplicated line-number prefix (e.g., 1| 1|actual content), likely from a bug in the previous coder's write_file where read_file output prefixes were written verbatim. This caused IndentationError preventing all test collection.

  2. _resolve_output_path default-dir bug: When output=None (default), if ~/cantaloupe-exports/ directory doesn't exist, Path.is_dir() returns False and the function treats the path as a file — losing the timestamp and writing to a bare ~/cantaloupe-exports file instead of ~/cantaloupe-exports/Machine List_TIMESTAMP.xlsx.

Fixes

  • test_auth.py: Cleaned with re.sub(r'^ *\d+\|', '', content, flags=re.MULTILINE) to strip prefix
  • _resolve_output_path: Added output is None to the directory-branch condition so default path always gets timestamped filename

Commits

  • b5ae89a — fix(download): fix _resolve_output_path default dir, add 20 download tests

Test Results

47 tests passing (27 auth + 20 download)

## Problems 1. **test_auth.py corrupted**: Every line had a duplicated line-number prefix (e.g., ` 1| 1|actual content`), likely from a bug in the previous coder's write_file where read_file output prefixes were written verbatim. This caused `IndentationError` preventing all test collection. 2. **_resolve_output_path default-dir bug**: When `output=None` (default), if `~/cantaloupe-exports/` directory doesn't exist, `Path.is_dir()` returns False and the function treats the path as a file — losing the timestamp and writing to a bare `~/cantaloupe-exports` file instead of `~/cantaloupe-exports/Machine List_TIMESTAMP.xlsx`. ## Fixes - **test_auth.py**: Cleaned with `re.sub(r'^ *\d+\|', '', content, flags=re.MULTILINE)` to strip prefix - **_resolve_output_path**: Added `output is None` to the directory-branch condition so default path always gets timestamped filename ## Commits - b5ae89a — fix(download): fix _resolve_output_path default dir, add 20 download tests ## Test Results 47 tests passing (27 auth + 20 download)
shawn closed this issue 2026-05-21 22:11:55 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shawn/cantaloupe-downloader#3