From 81fcc721ee8d0a8add1f1c7469dbc955c0d10cdf Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Sun, 28 Jul 2024 13:15:37 +0200 Subject: [PATCH] Basic exclusions for DB Isolation mode (#41079) After creating the full test harness for the DB isolation mode in #41067, and runnning the whole test suite, this is the result of first pass of exclusions of those tests that are not relevant for the DB isolation mode. Related: #41067 --- tests/always/test_example_dags.py | 1 + tests/api_connexion/endpoints/test_config_endpoint.py | 2 +- tests/api_connexion/endpoints/test_connection_endpoint.py | 2 +- tests/api_experimental/auth/backend/test_basic_auth.py | 2 +- tests/api_experimental/common/test_mark_tasks.py | 2 +- tests/cli/commands/test_dag_command.py | 2 +- tests/cli/commands/test_dag_processor_command.py | 2 +- tests/jobs/test_backfill_job.py | 2 +- .../security_manager/test_aws_security_manager_override.py | 2 ++ .../amazon/aws/auth_manager/test_aws_auth_manager.py | 5 ++++- tests/www/api/experimental/test_dag_runs_endpoint.py | 2 +- tests/www/api/experimental/test_endpoints.py | 2 +- tests/www/test_app.py | 2 +- 13 files changed, 17 insertions(+), 11 deletions(-) diff --git a/tests/always/test_example_dags.py b/tests/always/test_example_dags.py index 0635f8042ad57..d8c97ca4f0434 100644 --- a/tests/always/test_example_dags.py +++ b/tests/always/test_example_dags.py @@ -189,6 +189,7 @@ def test_should_be_importable(example: str): assert len(dagbag.dag_ids) >= 1 +@pytest.mark.skip_if_database_isolation_mode @pytest.mark.db_test @pytest.mark.parametrize("example", example_not_excluded_dags(xfail_db_exception=True)) def test_should_not_do_database_queries(example: str): diff --git a/tests/api_connexion/endpoints/test_config_endpoint.py b/tests/api_connexion/endpoints/test_config_endpoint.py index 3dd5814e5d79e..ea4f6e9647465 100644 --- a/tests/api_connexion/endpoints/test_config_endpoint.py +++ b/tests/api_connexion/endpoints/test_config_endpoint.py @@ -25,7 +25,7 @@ from tests.test_utils.api_connexion_utils import assert_401, create_user, delete_user from tests.test_utils.config import conf_vars -pytestmark = pytest.mark.db_test +pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode] MOCK_CONF = { diff --git a/tests/api_connexion/endpoints/test_connection_endpoint.py b/tests/api_connexion/endpoints/test_connection_endpoint.py index 7e287af7553ae..75a745c76dc65 100644 --- a/tests/api_connexion/endpoints/test_connection_endpoint.py +++ b/tests/api_connexion/endpoints/test_connection_endpoint.py @@ -31,7 +31,7 @@ from tests.test_utils.db import clear_db_connections from tests.test_utils.www import _check_last_log -pytestmark = pytest.mark.db_test +pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode] @pytest.fixture(scope="module") diff --git a/tests/api_experimental/auth/backend/test_basic_auth.py b/tests/api_experimental/auth/backend/test_basic_auth.py index a7f7a2a1cd8a8..162f96e5a8270 100644 --- a/tests/api_experimental/auth/backend/test_basic_auth.py +++ b/tests/api_experimental/auth/backend/test_basic_auth.py @@ -24,7 +24,7 @@ from airflow.exceptions import RemovedInAirflow3Warning from tests.test_utils.db import clear_db_pools -pytestmark = pytest.mark.db_test +pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode] class TestBasicAuth: diff --git a/tests/api_experimental/common/test_mark_tasks.py b/tests/api_experimental/common/test_mark_tasks.py index 83b966c2095f9..e90938ca69877 100644 --- a/tests/api_experimental/common/test_mark_tasks.py +++ b/tests/api_experimental/common/test_mark_tasks.py @@ -43,7 +43,7 @@ DEV_NULL = "/dev/null" -pytestmark = pytest.mark.db_test +pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode] @pytest.fixture(scope="module") diff --git a/tests/cli/commands/test_dag_command.py b/tests/cli/commands/test_dag_command.py index a8e863ffc4a22..d8322f27dd5df 100644 --- a/tests/cli/commands/test_dag_command.py +++ b/tests/cli/commands/test_dag_command.py @@ -58,7 +58,7 @@ # TODO: Check if tests needs side effects - locally there's missing DAG -pytestmark = pytest.mark.db_test +pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode] class TestCliDags: diff --git a/tests/cli/commands/test_dag_processor_command.py b/tests/cli/commands/test_dag_processor_command.py index 59da9efbb9684..2b84f506e78f1 100644 --- a/tests/cli/commands/test_dag_processor_command.py +++ b/tests/cli/commands/test_dag_processor_command.py @@ -26,7 +26,7 @@ from airflow.configuration import conf from tests.test_utils.config import conf_vars -pytestmark = pytest.mark.db_test +pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode] class TestDagProcessorCommand: diff --git a/tests/jobs/test_backfill_job.py b/tests/jobs/test_backfill_job.py index 41630f858658d..e46f27ed62459 100644 --- a/tests/jobs/test_backfill_job.py +++ b/tests/jobs/test_backfill_job.py @@ -70,7 +70,7 @@ from tests.test_utils.mock_executor import MockExecutor from tests.test_utils.timetables import cron_timetable -pytestmark = pytest.mark.db_test +pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode] logger = logging.getLogger(__name__) diff --git a/tests/providers/amazon/aws/auth_manager/security_manager/test_aws_security_manager_override.py b/tests/providers/amazon/aws/auth_manager/security_manager/test_aws_security_manager_override.py index 62da8b6339d7d..69b48f4f0c258 100644 --- a/tests/providers/amazon/aws/auth_manager/security_manager/test_aws_security_manager_override.py +++ b/tests/providers/amazon/aws/auth_manager/security_manager/test_aws_security_manager_override.py @@ -29,6 +29,8 @@ ) from airflow.www.extensions.init_appbuilder import init_appbuilder +pytestmark = pytest.mark.skip_if_database_isolation_mode + @pytest.fixture def appbuilder(): diff --git a/tests/providers/amazon/aws/auth_manager/test_aws_auth_manager.py b/tests/providers/amazon/aws/auth_manager/test_aws_auth_manager.py index a4a9472000708..c26c07cd8bf1d 100644 --- a/tests/providers/amazon/aws/auth_manager/test_aws_auth_manager.py +++ b/tests/providers/amazon/aws/auth_manager/test_aws_auth_manager.py @@ -66,7 +66,10 @@ if TYPE_CHECKING: from airflow.auth.managers.base_auth_manager import ResourceMethod -pytestmark = pytest.mark.skipif(not AIRFLOW_V_2_9_PLUS, reason="Test requires Airflow 2.9+") +pytestmark = [ + pytest.mark.skipif(not AIRFLOW_V_2_9_PLUS, reason="Test requires Airflow 2.9+"), + pytest.mark.skip_if_database_isolation_mode, +] mock = Mock() diff --git a/tests/www/api/experimental/test_dag_runs_endpoint.py b/tests/www/api/experimental/test_dag_runs_endpoint.py index 9f4bbf30bc41e..7ab3def6cc1d7 100644 --- a/tests/www/api/experimental/test_dag_runs_endpoint.py +++ b/tests/www/api/experimental/test_dag_runs_endpoint.py @@ -26,7 +26,7 @@ from airflow.models.serialized_dag import SerializedDagModel from airflow.settings import Session -pytestmark = pytest.mark.db_test +pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode] class TestDagRunsEndpoint: diff --git a/tests/www/api/experimental/test_endpoints.py b/tests/www/api/experimental/test_endpoints.py index d78bc8fb37232..444110b2d8e12 100644 --- a/tests/www/api/experimental/test_endpoints.py +++ b/tests/www/api/experimental/test_endpoints.py @@ -40,7 +40,7 @@ os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir, os.pardir, os.pardir) ) -pytestmark = pytest.mark.db_test +pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode] @pytest.fixture(scope="module") diff --git a/tests/www/test_app.py b/tests/www/test_app.py index 1e7bd67c9ae04..7fd648675e7bf 100644 --- a/tests/www/test_app.py +++ b/tests/www/test_app.py @@ -32,7 +32,7 @@ from tests.test_utils.config import conf_vars from tests.test_utils.decorators import dont_initialize_flask_app_submodules -pytestmark = pytest.mark.db_test +pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode] class TestApp: