Skip to content

Commit 495fae1

Browse files
committed
stop tests from checking error messages - we should be using the name, not fragile checks
1 parent c3c512f commit 495fae1

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

CLAUDE.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ The project follows a layered architecture:
1212

1313
1. **Main Entry Point** (`main.py`): CLI interface that manages device monitoring and server lifecycle
1414
2. **Server Layer** (`server.py`): Orchestrates nbdkit, nbdfuse, and FUSE mounting
15-
3. **Plugin Layer** (`plugin.py`): nbdkit Python plugin that handles block device operations
16-
4. **Cache Layer** (`cache/`): Abstract caching interface and implementations
17-
5. **DiskMap** (`diskmap.py`): ddrescue-compatible mapfile handling for tracking read status
15+
3. **Backend Layer** (`backend.py`): nbdkit Python plugin that handles block device operations
16+
4. **File Layer** (`file/`): Modular file abstraction with automatic type detection and composition
17+
5. **FileMap** (`file/filemap.py`): ddrescue-compatible mapfile handling for tracking read status
1818

19-
The cache implementation appears to be in transition from a legacy global state approach to a more modular `Cache` class architecture.
19+
The implementation is in transition from a legacy global state approach in the backend to a modular File-based architecture using composition over inheritance.
2020

2121
## Development Commands
2222

@@ -58,7 +58,7 @@ Tests use pytest (functional style, not unittest OOP style). Test files mirror t
5858
2. **Block Size**: Default is 4KB, but can be auto-detected based on device type or specified manually
5959
3. **Caching**: Uses memory-mapped files for sector caching
6060
4. **Disk Status Tracking**: Compatible with ddrescue format for tracking read status
61-
5. **Transitions**: The DiskMap uses a transition-based approach for efficiently representing block states
61+
5. **Transitions**: The FileMap uses a transition-based approach for efficiently representing block states
6262

6363
## Code Style
6464

tests/unit/file/test_filemap.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,13 @@ def test_set_status_invalid_input(filemap):
267267

268268
def test_slice_bounds_negative_start(filemap):
269269
"""Test that negative start indices raise ValueError."""
270-
with pytest.raises(ValueError, match="Negative start index"):
270+
with pytest.raises(ValueError):
271271
filemap[-1:50] = STATUS_OK
272272

273273

274274
def test_slice_bounds_stop_beyond_size(filemap):
275275
"""Test that stop indices beyond device size raise ValueError."""
276-
with pytest.raises(ValueError, match="Stop index beyond device size"):
276+
with pytest.raises(ValueError):
277277
filemap[0:101] = STATUS_OK
278278

279279

@@ -373,11 +373,11 @@ def test_getitem_slice_empty_range(filemap):
373373
def test_getitem_slice_bounds_checking(filemap):
374374
"""Test __getitem__ slice bounds checking."""
375375
# Negative start should raise error
376-
with pytest.raises(ValueError, match="Negative start index"):
376+
with pytest.raises(ValueError):
377377
filemap[-1:50]
378378

379379
# Stop beyond size should raise error
380-
with pytest.raises(ValueError, match="Stop index beyond device size"):
380+
with pytest.raises(ValueError):
381381
filemap[0:101]
382382

383383

@@ -456,7 +456,7 @@ def test_pos_property_corrupted_no_untried(filemap):
456456
"""Test pos property raises error when transitions are corrupted."""
457457
filemap.transitions = [(0, NO_SORT, STATUS_OK), (100, NO_SORT, STATUS_OK)] # No untried
458458

459-
with pytest.raises(ValueError, match="FileMap transitions corrupted, someone deleted the end one"):
459+
with pytest.raises(ValueError):
460460
filemap.pos
461461

462462

@@ -492,7 +492,7 @@ def test_status_property_corrupted_insufficient_transitions():
492492
filemap = FileMap(100)
493493
filemap.transitions = [(0, NO_SORT, STATUS_OK)] # Missing end marker
494494

495-
with pytest.raises(ValueError, match="insufficient entries"):
495+
with pytest.raises(ValueError):
496496
filemap.status
497497

498498

@@ -502,7 +502,7 @@ def test_status_property_corrupted_no_valid_statuses():
502502
# Corrupt the transitions to have invalid status
503503
filemap.transitions = [(0, NO_SORT, "INVALID"), (100, NO_SORT, "INVALID")]
504504

505-
with pytest.raises(ValueError, match="no valid statuses found"):
505+
with pytest.raises(ValueError):
506506
filemap.status
507507

508508

0 commit comments

Comments
 (0)