Skip to content

Commit 440e6d6

Browse files
Copilotavsm
andcommitted
Replace unit test with cram test for temporary file handling
- Removed tests/test_tile_discovery.py unit test file - Added new cram test in tests/cli.t that creates temporary files manually - Test verifies info command silently ignores temp files without warnings - Test creates files matching typical temporary file patterns (.{name}_tmp_*) - Test validates tile count remains correct and no warnings appear Co-authored-by: avsm <53164+avsm@users.noreply.github.com>
1 parent 9abf770 commit 440e6d6

File tree

2 files changed

+16
-130
lines changed

2 files changed

+16
-130
lines changed

tests/cli.t

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,19 @@ Test that re-running the NPY download skips existing files:
185185
> --dataset-version v1 2>&1 | grep -E '(Skipped|existing files)'
186186
Skipped 48 existing files (resume capability)
187187

188+
Test: Tile Discovery Ignores Temporary Files
189+
---------------------------------------------
190+
191+
Test that temporary files left from interrupted downloads are silently ignored.
192+
Create temporary files manually in the NPY tiles directory to simulate interrupted downloads:
193+
194+
$ touch "$TESTDIR/uk_tiles_npy/global_0.1_degree_representation/2024/.grid_0.05_51.25.npy_tmp_abc123"
195+
$ touch "$TESTDIR/uk_tiles_npy/global_0.1_degree_representation/2024/.grid_0.05_51.35_tmp_xyz789.npy"
196+
$ touch "$TESTDIR/uk_tiles_npy/global_0.1_degree_representation/2024/invalid_file.npy"
197+
198+
Verify that the info command still works correctly and doesn't show warnings about temp files.
199+
The tile count should remain 16 (unchanged) and no warnings should appear in stderr:
200+
201+
$ uv run -m geotessera.cli info --tiles "$TESTDIR/uk_tiles_npy" 2>&1 | grep -E '(Total tiles|WARNING|Failed to load|Cannot parse)'
202+
Total tiles: 16
203+

tests/test_tile_discovery.py

Lines changed: 0 additions & 130 deletions
This file was deleted.

0 commit comments

Comments
 (0)