Lee-W commented on code in PR #45631: URL: https://github.com/apache/airflow/pull/45631#discussion_r1926330336
########## providers/tests/cncf/kubernetes/log_handlers/test_log_handlers.py: ########## @@ -74,7 +74,9 @@ def teardown_method(self): "airflow.providers.cncf.kubernetes.executors.kubernetes_executor.KubernetesExecutor.get_task_log" ) @pytest.mark.parametrize("state", [TaskInstanceState.RUNNING, TaskInstanceState.SUCCESS]) - def test__read_for_k8s_executor(self, mock_k8s_get_task_log, create_task_instance, state): + def test__read_for_k8s_executor( + self, mock_k8s_get_task_log, create_task_instance, state, clean_executor_loader Review Comment: I think we can use `usefixtures` here as it's not used in the test method https://docs.pytest.org/en/stable/how-to/fixtures.html#use-fixtures-in-classes-and-modules-with-usefixtures ########## tests/executors/test_executor_loader.py: ########## @@ -36,23 +35,17 @@ class FakeExecutor: class TestExecutorLoader: - def setup_method(self) -> None: - from airflow.executors import executor_loader + @pytest.fixture(autouse=True) + def setup_method(self, clean_executor_loader) -> None: Review Comment: Should we merge `setup_method` and `teardown_method` as a fixture and make it `autouse` of `TestExecutorLoader` ########## tests_common/pytest_plugin.py: ########## @@ -1567,6 +1567,16 @@ def clean_dags_and_dagruns(): clear_db_runs() +@pytest.fixture +def clean_executor_loader(): + from tests_common.test_utils.executor_loader import clean_executor_loader_module + + """Clean the executor_loader state, as it stores global variables in the module, causing side effects for some tests.""" Review Comment: ```suggestion """Clean the executor_loader state, as it stores global variables in the module, causing side effects for some tests.""" from tests_common.test_utils.executor_loader import clean_executor_loader_module ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org