From 9935a868ee5ac65f5f30b07748280d775ebe27af Mon Sep 17 00:00:00 2001 From: Mark Story Date: Wed, 9 Aug 2023 07:22:11 -0700 Subject: [PATCH] fix(hybridcloud) Ignore fixtures/ from production code linting. (#54416) Add an ignore to metrics code as well. Unwinding this testutils import doesn't seem straightforward and it would be better if the original team took on this work. --- src/sentry/sentry_metrics/client/snuba.py | 2 +- tools/flake8_plugin.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sentry/sentry_metrics/client/snuba.py b/src/sentry/sentry_metrics/client/snuba.py index 00bd45de30951..ce21b7a03ce19 100644 --- a/src/sentry/sentry_metrics/client/snuba.py +++ b/src/sentry/sentry_metrics/client/snuba.py @@ -8,7 +8,7 @@ from sentry import quotas from sentry.sentry_metrics.client.base import GenericMetricsBackend from sentry.sentry_metrics.use_case_id_registry import UseCaseID -from sentry.testutils.cases import BaseMetricsTestCase +from sentry.testutils.cases import BaseMetricsTestCase # NOQA:S007 def build_mri(metric_name: str, type: str, use_case_id: UseCaseID, unit: Optional[str]) -> str: diff --git a/tools/flake8_plugin.py b/tools/flake8_plugin.py index b9776a4eb57ab..2e26041da8e24 100644 --- a/tools/flake8_plugin.py +++ b/tools/flake8_plugin.py @@ -49,6 +49,7 @@ def visit_ImportFrom(self, node: ast.ImportFrom) -> None: self.errors.append((node.lineno, node.col_offset, S006_msg)) elif ( "tests/" not in self.filename + and "fixtures/" not in self.filename and "sentry/testutils/" not in self.filename and "sentry.testutils" in node.module ): @@ -62,6 +63,7 @@ def visit_Import(self, node: ast.Import) -> None: self.errors.append((node.lineno, node.col_offset, S003_msg)) elif ( "tests/" not in self.filename + and "fixtures/" not in self.filename and "sentry/testutils/" not in self.filename and "sentry.testutils" in alias.name ):