Skip to content

Add analytics filesystem fallback tests #1119

@VaibhavUpreti

Description

@VaibhavUpreti

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

  1. Add a test for _get_or_create_anonymous_id() when file IO raises OSError.
  2. Assert it still returns a non-empty UUID-like string.
  3. Add a test for _touch_once() or capture_install_detected_if_needed() when the marker file cannot be written.
  4. 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

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is neededtestsTest coverage and test organization

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions