Skip to content

Conversation

iw4p
Copy link

@iw4p iw4p commented Oct 3, 2025

Replace DetectorGroup.objects.create() with create_detector_group() factory method in test_organization_open_periods.py to comply with Sentry testing standards.

The test was violating the mandatory Python testing rule that prohibits direct Model.objects.create() calls. This change:

  • Uses the proper factory method from sentry.testutils.fixtures.Fixtures
  • Maintains identical test behavior and coverage
  • Follows Sentry's testing best practices
  • Ensures proper test setup logic is applied

Files changed:

  • tests/sentry/workflow_engine/endpoints/test_organization_open_periods.py

Testing:

  • All existing tests pass with no modifications to test logic
  • No linter errors introduced

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Replace DetectorGroup.objects.create() with create_detector_group() factory method in test_organization_open_periods.py to comply with Sentry testing standards.

The test was violating the mandatory Python testing rule that prohibits direct Model.objects.create() calls. This change:

- Uses the proper factory method from sentry.testutils.fixtures.Fixtures
- Maintains identical test behavior and coverage
- Follows Sentry's testing best practices
- Ensures proper test setup logic is applied

Files changed:
- tests/sentry/workflow_engine/endpoints/test_organization_open_periods.py

Testing:
- All existing tests pass with no modifications to test logic
- No linter errors introduced
@iw4p iw4p requested a review from a team as a code owner October 3, 2025 22:24
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.

1 participant