Why this matters
The analytics helper is supposed to fail safe when it cannot write marker files or the anonymous ID file.
Files to touch
tests/analytics/test_provider.py
Exactly what to do
- Add a test for
_get_or_create_anonymous_id() when file IO raises OSError.
- Assert it still returns a non-empty UUID-like string.
- Add a test for
_touch_once() or capture_install_detected_if_needed() when the marker file cannot be written.
- Assert the function returns
False instead of crashing.
Done when
- Error-path behavior is covered for both anonymous ID creation and one-time install marker creation
- No real filesystem permissions tricks are needed; use monkeypatching
Verify
python -m pytest tests/analytics/test_provider.py -q
Why this matters
The analytics helper is supposed to fail safe when it cannot write marker files or the anonymous ID file.
Files to touch
tests/analytics/test_provider.pyExactly what to do
_get_or_create_anonymous_id()when file IO raisesOSError._touch_once()orcapture_install_detected_if_needed()when the marker file cannot be written.Falseinstead of crashing.Done when
Verify