Commit c5c08d1
wildleo91
test(limits): patch wl_limits.fcntl in 2 mocked-open write tests
Both test_set_limit_config_valid and test_write_daily_limits_success
mock builtins.open() with mock_open(). On Python 3.9 the resulting
Mock fd was leniently accepted by fcntl.flock; on Python 3.11+
fcntl.flock raises TypeError: fileno() returned a non-integer.
The bug was masked for the entire round-7 window because the install
step itself failed (pytest 9.0.3 requires Python >=3.10 but CI used
3.9), so these tests never executed. Phase 0.2's Python bump
unmasked them.
Fix: patch `wl_limits.fcntl` to a MagicMock in both tests so the
inline flock calls become no-ops. Test semantics unchanged — neither
test asserts on what was written to disk; they only verify the
"happy path" doesn't raise and (for the second) that open() was
invoked. Other tests in test_limits.py use mock_open(read_data=...)
or side_effect=OSError, neither of which reaches a flock call, so
no other tests need this patch.
Verified locally:
- tests/unit/test_limits.py::test_set_limit_config_valid PASS
- tests/unit/test_limits.py::test_write_daily_limits_success PASS
- Full test_limits.py: 45/45 pass
CI on Linux/Python 3.11 will exercise the actual fcntl path and is
the real gate; local Windows skips the path because fcntl is None
on Windows.1 parent b4757ec commit c5c08d1
1 file changed
Lines changed: 18 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
447 | | - | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
448 | 452 | | |
449 | 453 | | |
450 | 454 | | |
451 | 455 | | |
452 | 456 | | |
453 | | - | |
454 | | - | |
455 | | - | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
456 | 461 | | |
457 | 462 | | |
458 | 463 | | |
| |||
654 | 659 | | |
655 | 660 | | |
656 | 661 | | |
657 | | - | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
658 | 667 | | |
659 | 668 | | |
660 | 669 | | |
661 | 670 | | |
662 | 671 | | |
663 | | - | |
664 | | - | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
665 | 675 | | |
666 | 676 | | |
667 | 677 | | |
| |||
0 commit comments