Skip to content

test(sensor): isolate redirected APPDATA test - #111

Merged
pengyuzhang merged 2 commits into
uber:mainfrom
weibit:fix/sensor-appdata-test-isolation
Aug 26, 2026
Merged

test(sensor): isolate redirected APPDATA test#111
pengyuzhang merged 2 commits into
uber:mainfrom
weibit:fix/sensor-appdata-test-isolation

Conversation

@weibit

@weibit weibit commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Related issue:

N/A

What changed?

Updated the redirected %APPDATA% Cursor parser test to use pytest's monkeypatch fixture and deterministic database candidates.

Why?

The test previously searched the normal macOS Cursor database before the temporary Windows database. On macOS systems with Cursor installed, the real database was selected and the test failed.

The revised test is isolated from applications and log files installed on the host machine.

How did you test it?

  • uv run pytest -q
    Result: 123 passed
  • uv run ruff check adr_sensor tests

Potential risks

Low. This changes test setup only and does not modify production parser behavior.

@CLAassistant

CLAassistant commented Aug 25, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment thread Sensor/tests/test_parsers.py Outdated

@weibit weibit left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your review. You are right, the previous version bypassed the production APPDATA-to-DB_PATHS link. I updated the test to set APPDATA, reload cursor_parser, retain the Windows candidate generated by the reloaded CursorParser.DB_PATHS, and replace only the macOS/Linux candidates with nonexistent paths. The module is restored in a finally block. The full 123-test Sensor suite passed.

@pengyuzhang pengyuzhang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the redirected APPDATA test isolation change. No blocking findings. Verified the exact PR head: 123 Sensor tests pass, and the changed test file passes Ruff.

@weibit weibit closed this Aug 26, 2026
@weibit weibit reopened this Aug 26, 2026
@weibit

weibit commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

My apologies. I accidentally clicked “Close pull request.” Reopening it for merge.

@pengyuzhang
pengyuzhang merged commit 54a8688 into uber:main Aug 26, 2026
8 checks passed
@weibit
weibit deleted the fix/sensor-appdata-test-isolation branch August 26, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants