You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(dev-infra): Fix test discovery for Cursor (#92378)
<!-- Describe your PR here. -->
The Test Discovery feature in Cursor was broken due to a couple errors.
First, we were checking for the presence of `vscode` but not `cursor` in
the `in_test_environment()` function, causing several internal functions
to throw an error.
Second, `TestEnvRegionDirectory` was being detected as a test due to the
naming, though it doesn't appear to be:
```
_______________ ERROR collecting src/sentry/testutils/region.py ________________
.venv/lib/python3.13/site-packages/_pytest/runner.py:340: in from_call
result: Optional[TResult] = func()
.venv/lib/python3.13/site-packages/_pytest/runner.py:388: in collect
return list(collector.collect())
.venv/lib/python3.13/site-packages/_pytest/python.py:774: in collect
self.warn(
.venv/lib/python3.13/site-packages/_pytest/nodes.py:275: in warn
warnings.warn_explicit(
E pytest.PytestCollectionWarning: cannot collect test class 'TestEnvRegionDirectory' because it has a __init__ constructor (from: src/sentry/testutils/region.py)
```
After my changes I'm able to see all of our tests:
<img width="372" alt="Screenshot 2025-05-27 at 7 08 31 PM"
src="https://github.com/user-attachments/assets/c30987d2-dfb1-4350-8462-caf5766a52aa"
/>
0 commit comments