diff --git a/pyproject.toml b/pyproject.toml index 6ef34d1115c08..8b05b5588a4c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -421,8 +421,7 @@ module = [ "sentry.eventtypes.error", "sentry.grouping.component", "sentry.grouping.fingerprinting", - "sentry.grouping.ingest.metrics", - "sentry.grouping.ingest.utils", + "sentry.grouping.ingest.*", "sentry.grouping.parameterization", "sentry.hybridcloud.*", "sentry.ingest.slicing", @@ -537,6 +536,7 @@ module = [ "sentry_plugins.base", "tests.sentry.deletions.test_group", "tests.sentry.event_manager.test_event_manager", + "tests.sentry.grouping.ingest.test_seer", "tests.sentry.grouping.test_fingerprinting", "tests.sentry.hybridcloud.*", "tests.sentry.issues", diff --git a/tests/sentry/grouping/ingest/test_seer.py b/tests/sentry/grouping/ingest/test_seer.py index 5920faaa93a7a..3013776dc012b 100644 --- a/tests/sentry/grouping/ingest/test_seer.py +++ b/tests/sentry/grouping/ingest/test_seer.py @@ -14,7 +14,7 @@ class ShouldCallSeerTest(TestCase): - def setUp(self): + def setUp(self) -> None: self.event_data = { "title": "FailedToFetchError('Charlie didn't bring the ball back')", "exception": { @@ -45,7 +45,7 @@ def setUp(self): self.variants = self.event.get_grouping_variants() self.primary_hashes = self.event.get_hashes() - def test_obeys_feature_enablement_check(self): + def test_obeys_feature_enablement_check(self) -> None: for backfill_completed_option, expected_result in [(None, False), (11211231, True)]: self.project.update_option( "sentry:similarity_backfill_completed", backfill_completed_option @@ -54,7 +54,7 @@ def test_obeys_feature_enablement_check(self): should_call_seer_for_grouping(self.event, self.variants) is expected_result ), f"Case {backfill_completed_option} failed." - def test_obeys_content_filter(self): + def test_obeys_content_filter(self) -> None: self.project.update_option("sentry:similarity_backfill_completed", int(time())) for content_eligibility, expected_result in [(True, True), (False, False)]: @@ -64,21 +64,21 @@ def test_obeys_content_filter(self): ): assert should_call_seer_for_grouping(self.event, self.variants) is expected_result - def test_obeys_global_seer_killswitch(self): + def test_obeys_global_seer_killswitch(self) -> None: self.project.update_option("sentry:similarity_backfill_completed", int(time())) for killswitch_enabled, expected_result in [(True, False), (False, True)]: with override_options({"seer.global-killswitch.enabled": killswitch_enabled}): assert should_call_seer_for_grouping(self.event, self.variants) is expected_result - def test_obeys_similarity_service_killswitch(self): + def test_obeys_similarity_service_killswitch(self) -> None: self.project.update_option("sentry:similarity_backfill_completed", int(time())) for killswitch_enabled, expected_result in [(True, False), (False, True)]: with override_options({"seer.similarity-killswitch.enabled": killswitch_enabled}): assert should_call_seer_for_grouping(self.event, self.variants) is expected_result - def test_obeys_project_specific_killswitch(self): + def test_obeys_project_specific_killswitch(self) -> None: self.project.update_option("sentry:similarity_backfill_completed", int(time())) for blocked_projects, expected_result in [([self.project.id], False), ([], True)]: @@ -87,7 +87,7 @@ def test_obeys_project_specific_killswitch(self): ): assert should_call_seer_for_grouping(self.event, self.variants) is expected_result - def test_obeys_global_ratelimit(self): + def test_obeys_global_ratelimit(self) -> None: self.project.update_option("sentry:similarity_backfill_completed", int(time())) for ratelimit_enabled, expected_result in [(True, False), (False, True)]: @@ -99,7 +99,7 @@ def test_obeys_global_ratelimit(self): ): assert should_call_seer_for_grouping(self.event, self.variants) is expected_result - def test_obeys_project_ratelimit(self): + def test_obeys_project_ratelimit(self) -> None: self.project.update_option("sentry:similarity_backfill_completed", int(time())) for ratelimit_enabled, expected_result in [(True, False), (False, True)]: @@ -113,7 +113,7 @@ def test_obeys_project_ratelimit(self): ): assert should_call_seer_for_grouping(self.event, self.variants) is expected_result - def test_obeys_circuit_breaker(self): + def test_obeys_circuit_breaker(self) -> None: self.project.update_option("sentry:similarity_backfill_completed", int(time())) for request_allowed, expected_result in [(True, True), (False, False)]: @@ -123,7 +123,7 @@ def test_obeys_circuit_breaker(self): ): assert should_call_seer_for_grouping(self.event, self.variants) is expected_result - def test_obeys_customized_fingerprint_check(self): + def test_obeys_customized_fingerprint_check(self) -> None: self.project.update_option("sentry:similarity_backfill_completed", int(time())) default_fingerprint_event = Event( @@ -165,7 +165,7 @@ def test_obeys_customized_fingerprint_check(self): class GetSeerSimilarIssuesTest(TestCase): - def setUp(self): + def setUp(self) -> None: self.existing_event = save_new_event({"message": "Dogs are great!"}, self.project) assert self.existing_event.get_primary_hash() == "04e89719410791836f0a0bbf03bf0d2e" # In real life just filtering on group id wouldn't be enough to guarantee us a single, @@ -182,7 +182,7 @@ def setUp(self): assert self.new_event.get_primary_hash() == "3f11319f08263b2ee1e654779742955a" @patch("sentry.grouping.ingest.seer.get_similarity_data_from_seer", return_value=[]) - def test_sends_expected_data_to_seer(self, mock_get_similarity_data: MagicMock): + def test_sends_expected_data_to_seer(self, mock_get_similarity_data: MagicMock) -> None: type = "FailedToFetchError" value = "Charlie didn't bring the ball back" context_line = f"raise {type}('{value}')" @@ -226,7 +226,7 @@ def test_sends_expected_data_to_seer(self, mock_get_similarity_data: MagicMock): } ) - def test_returns_metadata_and_grouphash_if_sufficiently_close_group_found(self): + def test_returns_metadata_and_grouphash_if_sufficiently_close_group_found(self) -> None: seer_result_data = SeerSimilarIssueData( parent_hash=NonNone(self.existing_event.get_primary_hash()), parent_group_id=NonNone(self.existing_event.group_id), @@ -248,7 +248,7 @@ def test_returns_metadata_and_grouphash_if_sufficiently_close_group_found(self): self.existing_event_grouphash, ) - def test_returns_no_grouphash_and_empty_metadata_if_no_similar_group_found(self): + def test_returns_no_grouphash_and_empty_metadata_if_no_similar_group_found(self) -> None: expected_metadata = { "similarity_model_version": SEER_SIMILARITY_MODEL_VERSION, "results": [],