This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 7c14f20a87 Disable most irrelevant "core" tests in database isolation
mode (#41266)
7c14f20a87 is described below
commit 7c14f20a877390646ee8e64fdbd5ade445452fa0
Author: Jarek Potiuk <[email protected]>
AuthorDate: Mon Aug 5 19:49:30 2024 +0200
Disable most irrelevant "core" tests in database isolation mode (#41266)
A lot of the "core" tests are not relevant for database isolation
mode and they should be skipped.
Related: #41067
---
tests/core/test_core.py | 2 +-
tests/core/test_sentry.py | 2 ++
tests/core/test_sqlalchemy_config.py | 2 +-
tests/executors/test_base_executor.py | 2 ++
tests/executors/test_executor_loader.py | 2 ++
tests/executors/test_local_executor.py | 2 +-
tests/jobs/test_scheduler_job.py | 2 +-
tests/models/test_base.py | 2 +-
tests/models/test_cleartasks.py | 2 +-
tests/models/test_dag.py | 2 +-
tests/models/test_dagcode.py | 2 +-
tests/models/test_dagrun.py | 2 +-
tests/models/test_dagwarning.py | 2 +-
tests/models/test_pool.py | 2 +-
tests/ti_deps/deps/test_dag_ti_slots_available_dep.py | 2 +-
tests/ti_deps/deps/test_dag_unpaused_dep.py | 2 +-
tests/ti_deps/deps/test_dagrun_exists_dep.py | 2 +-
tests/ti_deps/deps/test_dagrun_id_dep.py | 2 +-
tests/ti_deps/deps/test_mapped_task_upstream_dep.py | 2 +-
tests/ti_deps/deps/test_not_in_retry_period_dep.py | 2 +-
tests/ti_deps/deps/test_not_previously_skipped_dep.py | 2 +-
tests/ti_deps/deps/test_pool_slots_available_dep.py | 2 +-
tests/ti_deps/deps/test_prev_dagrun_dep.py | 2 +-
tests/ti_deps/deps/test_ready_to_reschedule_dep.py | 2 +-
tests/ti_deps/deps/test_runnable_exec_date_dep.py | 2 +-
tests/ti_deps/deps/test_task_concurrency.py | 2 +-
tests/ti_deps/deps/test_task_not_running_dep.py | 2 +-
tests/ti_deps/deps/test_trigger_rule_dep.py | 2 +-
tests/ti_deps/deps/test_valid_state_dep.py | 2 +-
tests/utils/log/test_colored_log.py | 2 +-
tests/utils/log/test_log_reader.py | 2 +-
tests/utils/log/test_task_context_logger.py | 7 +++++++
tests/utils/test_cli_util.py | 5 +----
tests/utils/test_db.py | 2 +-
tests/utils/test_db_cleanup.py | 2 +-
tests/utils/test_dot_renderer.py | 2 +-
tests/utils/test_email.py | 2 ++
tests/utils/test_helpers.py | 2 ++
tests/utils/test_log_handlers.py | 2 +-
tests/utils/test_process_utils.py | 4 ++++
tests/utils/test_retries.py | 2 ++
tests/utils/test_session.py | 2 +-
tests/utils/test_sqlalchemy.py | 2 +-
tests/utils/test_state.py | 2 +-
tests/utils/test_types.py | 2 +-
tests/utils/test_usage_data_collection.py | 1 +
46 files changed, 61 insertions(+), 40 deletions(-)
diff --git a/tests/core/test_core.py b/tests/core/test_core.py
index 27b5b33843..a75428b33a 100644
--- a/tests/core/test_core.py
+++ b/tests/core/test_core.py
@@ -34,7 +34,7 @@ from airflow.utils.timezone import datetime
from airflow.utils.types import DagRunType
from tests.test_utils.db import clear_db_dags, clear_db_runs,
clear_db_task_fail
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
DEFAULT_DATE = datetime(2015, 1, 1)
diff --git a/tests/core/test_sentry.py b/tests/core/test_sentry.py
index 7097152259..b9a1ff7af8 100644
--- a/tests/core/test_sentry.py
+++ b/tests/core/test_sentry.py
@@ -141,6 +141,7 @@ class TestSentryHook:
importlib.reload(sentry)
+ @pytest.mark.skip_if_database_isolation_mode
@pytest.mark.db_test
def test_add_tagging(self, sentry, task_instance):
"""
@@ -151,6 +152,7 @@ class TestSentryHook:
for key, value in scope._tags.items():
assert value == TEST_SCOPE[key]
+ @pytest.mark.skip_if_database_isolation_mode
@pytest.mark.db_test
@time_machine.travel(CRUMB_DATE)
def test_add_breadcrumbs(self, sentry, task_instance):
diff --git a/tests/core/test_sqlalchemy_config.py
b/tests/core/test_sqlalchemy_config.py
index 068f803a6f..154eb0a5f8 100644
--- a/tests/core/test_sqlalchemy_config.py
+++ b/tests/core/test_sqlalchemy_config.py
@@ -29,7 +29,7 @@ from tests.test_utils.config import conf_vars
SQL_ALCHEMY_CONNECT_ARGS = {"test": 43503, "dict": {"is": 1, "supported":
"too"}}
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestSqlAlchemySettings:
diff --git a/tests/executors/test_base_executor.py
b/tests/executors/test_base_executor.py
index 7c60cd42bc..8a60c50d34 100644
--- a/tests/executors/test_base_executor.py
+++ b/tests/executors/test_base_executor.py
@@ -37,6 +37,8 @@ from airflow.models.taskinstance import TaskInstance,
TaskInstanceKey
from airflow.utils import timezone
from airflow.utils.state import State, TaskInstanceState
+pytestmark = pytest.mark.skip_if_database_isolation_mode
+
def test_supports_sentry():
assert not BaseExecutor.supports_sentry
diff --git a/tests/executors/test_executor_loader.py
b/tests/executors/test_executor_loader.py
index 95fcb618dc..2192487a01 100644
--- a/tests/executors/test_executor_loader.py
+++ b/tests/executors/test_executor_loader.py
@@ -31,6 +31,8 @@ from airflow.providers.amazon.aws.executors.ecs.ecs_executor
import AwsEcsExecut
from airflow.providers.celery.executors.celery_executor import CeleryExecutor
from tests.test_utils.config import conf_vars
+pytestmark = pytest.mark.skip_if_database_isolation_mode
+
# Plugin Manager creates new modules, which is difficult to mock, so we use
test isolation by a unique name.
TEST_PLUGIN_NAME = "unique_plugin_name_to_avoid_collision_i_love_kitties"
diff --git a/tests/executors/test_local_executor.py
b/tests/executors/test_local_executor.py
index c49c3f48f5..9443f0395f 100644
--- a/tests/executors/test_local_executor.py
+++ b/tests/executors/test_local_executor.py
@@ -28,7 +28,7 @@ from airflow.exceptions import AirflowException
from airflow.executors.local_executor import LocalExecutor
from airflow.utils.state import State
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestLocalExecutor:
diff --git a/tests/jobs/test_scheduler_job.py b/tests/jobs/test_scheduler_job.py
index 981e210dff..2e96728d5e 100644
--- a/tests/jobs/test_scheduler_job.py
+++ b/tests/jobs/test_scheduler_job.py
@@ -87,7 +87,7 @@ from tests.test_utils.mock_executor import MockExecutor
from tests.test_utils.mock_operators import CustomOperator
from tests.utils.test_timezone import UTC
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
ROOT_FOLDER = os.path.realpath(
os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir,
os.pardir)
diff --git a/tests/models/test_base.py b/tests/models/test_base.py
index d85eda6dd2..3224616404 100644
--- a/tests/models/test_base.py
+++ b/tests/models/test_base.py
@@ -21,7 +21,7 @@ import pytest
from airflow.models.base import get_id_collation_args
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]
@pytest.mark.parametrize(
diff --git a/tests/models/test_cleartasks.py b/tests/models/test_cleartasks.py
index 308ff3be98..580d73acc0 100644
--- a/tests/models/test_cleartasks.py
+++ b/tests/models/test_cleartasks.py
@@ -37,7 +37,7 @@ from airflow.utils.types import DagRunType
from tests.models import DEFAULT_DATE
from tests.test_utils import db
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestClearTasks:
diff --git a/tests/models/test_dag.py b/tests/models/test_dag.py
index 271c1a11fa..cc628e6b8a 100644
--- a/tests/models/test_dag.py
+++ b/tests/models/test_dag.py
@@ -120,7 +120,7 @@ from tests.test_utils.timetables import cron_timetable,
delta_timetable
if TYPE_CHECKING:
from sqlalchemy.orm import Session
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
TEST_DATE = datetime_tz(2015, 1, 2, 0, 0)
diff --git a/tests/models/test_dagcode.py b/tests/models/test_dagcode.py
index df85a8808e..1d30c94863 100644
--- a/tests/models/test_dagcode.py
+++ b/tests/models/test_dagcode.py
@@ -32,7 +32,7 @@ from airflow.utils.file import open_maybe_zipped
from airflow.utils.session import create_session
from tests.test_utils.db import clear_db_dag_code
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
def make_example_dags(module):
diff --git a/tests/models/test_dagrun.py b/tests/models/test_dagrun.py
index 7a791aa365..6d0ef33bc5 100644
--- a/tests/models/test_dagrun.py
+++ b/tests/models/test_dagrun.py
@@ -51,7 +51,7 @@ from tests.test_utils import db
from tests.test_utils.config import conf_vars
from tests.test_utils.mock_operators import MockOperator
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
if TYPE_CHECKING:
diff --git a/tests/models/test_dagwarning.py b/tests/models/test_dagwarning.py
index 58d6e5c752..d3ef85d351 100644
--- a/tests/models/test_dagwarning.py
+++ b/tests/models/test_dagwarning.py
@@ -27,7 +27,7 @@ from airflow.models import DagModel
from airflow.models.dagwarning import DagWarning
from tests.test_utils.db import clear_db_dags
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestDagWarning:
diff --git a/tests/models/test_pool.py b/tests/models/test_pool.py
index 1911edd44a..3bd3b4f5ff 100644
--- a/tests/models/test_pool.py
+++ b/tests/models/test_pool.py
@@ -29,7 +29,7 @@ from airflow.utils.session import create_session
from airflow.utils.state import State
from tests.test_utils.db import clear_db_dags, clear_db_pools, clear_db_runs,
set_default_pool_slots
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
DEFAULT_DATE = timezone.datetime(2016, 1, 1)
diff --git a/tests/ti_deps/deps/test_dag_ti_slots_available_dep.py
b/tests/ti_deps/deps/test_dag_ti_slots_available_dep.py
index deabfa1d0b..1deff072bd 100644
--- a/tests/ti_deps/deps/test_dag_ti_slots_available_dep.py
+++ b/tests/ti_deps/deps/test_dag_ti_slots_available_dep.py
@@ -24,7 +24,7 @@ import pytest
from airflow.models import TaskInstance
from airflow.ti_deps.deps.dag_ti_slots_available_dep import
DagTISlotsAvailableDep
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestDagTISlotsAvailableDep:
diff --git a/tests/ti_deps/deps/test_dag_unpaused_dep.py
b/tests/ti_deps/deps/test_dag_unpaused_dep.py
index 3a6b324c3d..e3f740a54c 100644
--- a/tests/ti_deps/deps/test_dag_unpaused_dep.py
+++ b/tests/ti_deps/deps/test_dag_unpaused_dep.py
@@ -24,7 +24,7 @@ import pytest
from airflow.models import TaskInstance
from airflow.ti_deps.deps.dag_unpaused_dep import DagUnpausedDep
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestDagUnpausedDep:
diff --git a/tests/ti_deps/deps/test_dagrun_exists_dep.py
b/tests/ti_deps/deps/test_dagrun_exists_dep.py
index 33b039ada5..ea4d54227b 100644
--- a/tests/ti_deps/deps/test_dagrun_exists_dep.py
+++ b/tests/ti_deps/deps/test_dagrun_exists_dep.py
@@ -26,7 +26,7 @@ from airflow.models.dagrun import DagRun
from airflow.ti_deps.deps.dagrun_exists_dep import DagrunRunningDep
from airflow.utils.state import State
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestDagrunRunningDep:
diff --git a/tests/ti_deps/deps/test_dagrun_id_dep.py
b/tests/ti_deps/deps/test_dagrun_id_dep.py
index e701a910c5..6aced00b8e 100644
--- a/tests/ti_deps/deps/test_dagrun_id_dep.py
+++ b/tests/ti_deps/deps/test_dagrun_id_dep.py
@@ -25,7 +25,7 @@ from airflow.models.dagrun import DagRun
from airflow.ti_deps.deps.dagrun_backfill_dep import DagRunNotBackfillDep
from airflow.utils.types import DagRunType
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestDagrunRunningDep:
diff --git a/tests/ti_deps/deps/test_mapped_task_upstream_dep.py
b/tests/ti_deps/deps/test_mapped_task_upstream_dep.py
index e91ce905a1..a9f9a381a8 100644
--- a/tests/ti_deps/deps/test_mapped_task_upstream_dep.py
+++ b/tests/ti_deps/deps/test_mapped_task_upstream_dep.py
@@ -28,7 +28,7 @@ from airflow.ti_deps.deps.base_ti_dep import TIDepStatus
from airflow.ti_deps.deps.mapped_task_upstream_dep import MappedTaskUpstreamDep
from airflow.utils.state import TaskInstanceState
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
if TYPE_CHECKING:
from sqlalchemy.orm.session import Session
diff --git a/tests/ti_deps/deps/test_not_in_retry_period_dep.py
b/tests/ti_deps/deps/test_not_in_retry_period_dep.py
index d2b1555a3a..17736abbf7 100644
--- a/tests/ti_deps/deps/test_not_in_retry_period_dep.py
+++ b/tests/ti_deps/deps/test_not_in_retry_period_dep.py
@@ -28,7 +28,7 @@ from airflow.ti_deps.deps.not_in_retry_period_dep import
NotInRetryPeriodDep
from airflow.utils.state import State
from airflow.utils.timezone import datetime
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestNotInRetryPeriodDep:
diff --git a/tests/ti_deps/deps/test_not_previously_skipped_dep.py
b/tests/ti_deps/deps/test_not_previously_skipped_dep.py
index 14bbbbf98c..810e556a9f 100644
--- a/tests/ti_deps/deps/test_not_previously_skipped_dep.py
+++ b/tests/ti_deps/deps/test_not_previously_skipped_dep.py
@@ -28,7 +28,7 @@ from airflow.ti_deps.deps.not_previously_skipped_dep import
NotPreviouslySkipped
from airflow.utils.state import State
from airflow.utils.types import DagRunType
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
@pytest.fixture(autouse=True)
diff --git a/tests/ti_deps/deps/test_pool_slots_available_dep.py
b/tests/ti_deps/deps/test_pool_slots_available_dep.py
index b50d025389..c81657bbb6 100644
--- a/tests/ti_deps/deps/test_pool_slots_available_dep.py
+++ b/tests/ti_deps/deps/test_pool_slots_available_dep.py
@@ -28,7 +28,7 @@ from airflow.utils.session import create_session
from airflow.utils.state import TaskInstanceState
from tests.test_utils import db
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestPoolSlotsAvailableDep:
diff --git a/tests/ti_deps/deps/test_prev_dagrun_dep.py
b/tests/ti_deps/deps/test_prev_dagrun_dep.py
index 40b532c97c..499de24965 100644
--- a/tests/ti_deps/deps/test_prev_dagrun_dep.py
+++ b/tests/ti_deps/deps/test_prev_dagrun_dep.py
@@ -30,7 +30,7 @@ from airflow.utils.timezone import convert_to_utc, datetime
from airflow.utils.types import DagRunType
from tests.test_utils.db import clear_db_runs
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestPrevDagrunDep:
diff --git a/tests/ti_deps/deps/test_ready_to_reschedule_dep.py
b/tests/ti_deps/deps/test_ready_to_reschedule_dep.py
index 6a8689e9f2..568d6abf02 100644
--- a/tests/ti_deps/deps/test_ready_to_reschedule_dep.py
+++ b/tests/ti_deps/deps/test_ready_to_reschedule_dep.py
@@ -32,7 +32,7 @@ from airflow.utils.session import create_session
from airflow.utils.state import State
from tests.test_utils import db
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
DEFAULT_DATE = timezone.datetime(2016, 1, 1)
diff --git a/tests/ti_deps/deps/test_runnable_exec_date_dep.py
b/tests/ti_deps/deps/test_runnable_exec_date_dep.py
index 75488c079d..43063001b6 100644
--- a/tests/ti_deps/deps/test_runnable_exec_date_dep.py
+++ b/tests/ti_deps/deps/test_runnable_exec_date_dep.py
@@ -28,7 +28,7 @@ from airflow.ti_deps.deps.runnable_exec_date_dep import
RunnableExecDateDep
from airflow.utils.timezone import datetime
from airflow.utils.types import DagRunType
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
@pytest.fixture(autouse=True)
diff --git a/tests/ti_deps/deps/test_task_concurrency.py
b/tests/ti_deps/deps/test_task_concurrency.py
index 34373e76c9..43ae6d7e80 100644
--- a/tests/ti_deps/deps/test_task_concurrency.py
+++ b/tests/ti_deps/deps/test_task_concurrency.py
@@ -27,7 +27,7 @@ from airflow.models.dag import DAG
from airflow.ti_deps.dep_context import DepContext
from airflow.ti_deps.deps.task_concurrency_dep import TaskConcurrencyDep
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestTaskConcurrencyDep:
diff --git a/tests/ti_deps/deps/test_task_not_running_dep.py
b/tests/ti_deps/deps/test_task_not_running_dep.py
index 84fe637759..09d7686f04 100644
--- a/tests/ti_deps/deps/test_task_not_running_dep.py
+++ b/tests/ti_deps/deps/test_task_not_running_dep.py
@@ -25,7 +25,7 @@ import pytest
from airflow.ti_deps.deps.task_not_running_dep import TaskNotRunningDep
from airflow.utils.state import State
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestTaskNotRunningDep:
diff --git a/tests/ti_deps/deps/test_trigger_rule_dep.py
b/tests/ti_deps/deps/test_trigger_rule_dep.py
index 90b17ac430..80cb400a46 100644
--- a/tests/ti_deps/deps/test_trigger_rule_dep.py
+++ b/tests/ti_deps/deps/test_trigger_rule_dep.py
@@ -33,7 +33,7 @@ from airflow.ti_deps.deps.trigger_rule_dep import
TriggerRuleDep, _UpstreamTISta
from airflow.utils.state import DagRunState, TaskInstanceState
from airflow.utils.trigger_rule import TriggerRule
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
if TYPE_CHECKING:
from sqlalchemy.orm.session import Session
diff --git a/tests/ti_deps/deps/test_valid_state_dep.py
b/tests/ti_deps/deps/test_valid_state_dep.py
index 15e6c3f5aa..169e7bea97 100644
--- a/tests/ti_deps/deps/test_valid_state_dep.py
+++ b/tests/ti_deps/deps/test_valid_state_dep.py
@@ -26,7 +26,7 @@ from airflow.exceptions import AirflowException
from airflow.ti_deps.deps.valid_state_dep import ValidStateDep
from airflow.utils.state import State
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestValidStateDep:
diff --git a/tests/utils/log/test_colored_log.py
b/tests/utils/log/test_colored_log.py
index 1eb86868ca..91f7655b4f 100644
--- a/tests/utils/log/test_colored_log.py
+++ b/tests/utils/log/test_colored_log.py
@@ -25,7 +25,7 @@ import pytest
from airflow.configuration import conf
from airflow.utils.log.colored_log import CustomTTYColoredFormatter
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
@patch("airflow.utils.log.timezone_aware.TimezoneAware.formatTime")
diff --git a/tests/utils/log/test_log_reader.py
b/tests/utils/log/test_log_reader.py
index 53d45f3f4b..3216222909 100644
--- a/tests/utils/log/test_log_reader.py
+++ b/tests/utils/log/test_log_reader.py
@@ -41,7 +41,7 @@ from airflow.utils.types import DagRunType
from tests.test_utils.config import conf_vars
from tests.test_utils.db import clear_db_dags, clear_db_runs
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
if TYPE_CHECKING:
diff --git a/tests/utils/log/test_task_context_logger.py
b/tests/utils/log/test_task_context_logger.py
index d1e5339b04..2cb92b1786 100644
--- a/tests/utils/log/test_task_context_logger.py
+++ b/tests/utils/log/test_task_context_logger.py
@@ -28,6 +28,8 @@ from tests.test_utils.config import conf_vars
logger = logging.getLogger(__name__)
+pytestmark = pytest.mark.skip_if_database_isolation_mode
+
@pytest.fixture
def mock_handler():
@@ -66,6 +68,7 @@ def
test_task_handler_not_supports_task_context_logging(mock_handler, supported)
assert t.enabled is supported
[email protected]_if_database_isolation_mode
@pytest.mark.db_test
@pytest.mark.parametrize("supported", [True, False])
def test_task_context_log_with_correct_arguments(ti, mock_handler, supported):
@@ -80,6 +83,7 @@ def test_task_context_log_with_correct_arguments(ti,
mock_handler, supported):
mock_handler.emit.assert_not_called()
[email protected]_if_database_isolation_mode
@pytest.mark.db_test
@mock.patch("airflow.utils.log.task_context_logger._ensure_ti")
@pytest.mark.parametrize("supported", [True, False])
@@ -97,6 +101,7 @@ def
test_task_context_log_with_task_instance_key(mock_ensure_ti, ti, mock_handle
mock_handler.emit.assert_not_called()
[email protected]_if_database_isolation_mode
@pytest.mark.db_test
def test_task_context_log_closes_task_handler(ti, mock_handler):
t = TaskContextLogger("blah")
@@ -104,6 +109,8 @@ def test_task_context_log_closes_task_handler(ti,
mock_handler):
mock_handler.close.assert_called_once()
[email protected]_if_database_isolation_mode
[email protected]_if_database_isolation_mode
@pytest.mark.db_test
def test_task_context_log_also_emits_to_call_site_logger(ti):
logger = logging.getLogger("abc123567")
diff --git a/tests/utils/test_cli_util.py b/tests/utils/test_cli_util.py
index fdb5098ff4..395db77e03 100644
--- a/tests/utils/test_cli_util.py
+++ b/tests/utils/test_cli_util.py
@@ -38,7 +38,7 @@ from airflow.utils.cli import _search_for_dag_file,
get_dag_by_pickle
# Mark entire module as db_test because ``action_cli`` wrapper still could use
DB on callbacks:
# - ``cli_action_loggers.on_pre_execution``
# - ``cli_action_loggers.on_post_execution``
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
repo_root = Path(airflow.__file__).parent.parent
@@ -82,7 +82,6 @@ class TestCliUtil:
def test_process_subdir_path_with_placeholder(self):
assert os.path.join(settings.DAGS_FOLDER, "abc") ==
cli.process_subdir("DAGS_FOLDER/abc")
- @pytest.mark.db_test
def test_get_dags(self):
dags = cli.get_dags(None, "example_subdag_operator")
assert len(dags) == 1
@@ -93,7 +92,6 @@ class TestCliUtil:
with pytest.raises(AirflowException):
cli.get_dags(None, "foobar", True)
- @pytest.mark.db_test
@pytest.mark.parametrize(
["given_command", "expected_masked_command"],
[
@@ -174,7 +172,6 @@ class TestCliUtil:
pid, _, _, _ = cli.setup_locations(process=process_name)
assert pid == default_pid_path
- @pytest.mark.db_test
def test_get_dag_by_pickle(self, session, dag_maker):
from airflow.models.dagpickle import DagPickle
diff --git a/tests/utils/test_db.py b/tests/utils/test_db.py
index 7312906abf..7468f84a83 100644
--- a/tests/utils/test_db.py
+++ b/tests/utils/test_db.py
@@ -52,7 +52,7 @@ from airflow.utils.db import (
)
from airflow.utils.session import NEW_SESSION
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestDb:
diff --git a/tests/utils/test_db_cleanup.py b/tests/utils/test_db_cleanup.py
index 6dcd2efa3b..6e8c770739 100644
--- a/tests/utils/test_db_cleanup.py
+++ b/tests/utils/test_db_cleanup.py
@@ -50,7 +50,7 @@ from airflow.utils.db_cleanup import (
from airflow.utils.session import create_session
from tests.test_utils.db import clear_db_dags, clear_db_datasets,
clear_db_runs, drop_tables_with_prefix
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
@pytest.fixture(autouse=True)
diff --git a/tests/utils/test_dot_renderer.py b/tests/utils/test_dot_renderer.py
index 2408a67fe2..b1bf2863f4 100644
--- a/tests/utils/test_dot_renderer.py
+++ b/tests/utils/test_dot_renderer.py
@@ -34,7 +34,7 @@ from tests.test_utils.db import clear_db_dags
START_DATE = timezone.utcnow()
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestDotRenderer:
diff --git a/tests/utils/test_email.py b/tests/utils/test_email.py
index 33ba317be6..ea85f635aa 100644
--- a/tests/utils/test_email.py
+++ b/tests/utils/test_email.py
@@ -36,6 +36,8 @@ EMAILS = ["[email protected]", "[email protected]"]
send_email_test = mock.MagicMock()
+pytestmark = pytest.mark.skip_if_database_isolation_mode
+
class TestEmail:
def setup_method(self):
diff --git a/tests/utils/test_helpers.py b/tests/utils/test_helpers.py
index 27ef5a76db..478604186e 100644
--- a/tests/utils/test_helpers.py
+++ b/tests/utils/test_helpers.py
@@ -43,6 +43,8 @@ from tests.test_utils.db import clear_db_dags, clear_db_runs
if TYPE_CHECKING:
from airflow.jobs.job import Job
+pytestmark = pytest.mark.skip_if_database_isolation_mode
+
@pytest.fixture
def clear_db():
diff --git a/tests/utils/test_log_handlers.py b/tests/utils/test_log_handlers.py
index 2d90c7755a..a9d9bfbabe 100644
--- a/tests/utils/test_log_handlers.py
+++ b/tests/utils/test_log_handlers.py
@@ -57,7 +57,7 @@ from airflow.utils.timezone import datetime
from airflow.utils.types import DagRunType
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]
DEFAULT_DATE = datetime(2016, 1, 1)
TASK_LOGGER = "airflow.task"
diff --git a/tests/utils/test_process_utils.py
b/tests/utils/test_process_utils.py
index ac591248ae..54bdc5bf9f 100644
--- a/tests/utils/test_process_utils.py
+++ b/tests/utils/test_process_utils.py
@@ -40,6 +40,8 @@ from airflow.utils.process_utils import (
set_new_process_group,
)
+pytestmark = pytest.mark.skip_if_database_isolation_mode
+
class TestReapProcessGroup:
@staticmethod
@@ -99,6 +101,7 @@ class TestReapProcessGroup:
pass
[email protected]_if_database_isolation_mode
@pytest.mark.db_test
class TestExecuteInSubProcess:
def test_should_print_all_messages1(self, caplog):
@@ -136,6 +139,7 @@ def my_sleep_subprocess_with_signals():
sleep(100)
[email protected]_if_database_isolation_mode
@pytest.mark.db_test
class TestKillChildProcessesByPids:
def test_should_kill_process(self):
diff --git a/tests/utils/test_retries.py b/tests/utils/test_retries.py
index d0d422e8ba..ac4073554c 100644
--- a/tests/utils/test_retries.py
+++ b/tests/utils/test_retries.py
@@ -29,6 +29,8 @@ from airflow.utils.retries import retry_db_transaction
if TYPE_CHECKING:
from sqlalchemy.exc import DBAPIError
+pytestmark = pytest.mark.skip_if_database_isolation_mode
+
class TestRetries:
def test_retry_db_transaction_with_passing_retries(self):
diff --git a/tests/utils/test_session.py b/tests/utils/test_session.py
index 70e2f03c2a..82d0a00a26 100644
--- a/tests/utils/test_session.py
+++ b/tests/utils/test_session.py
@@ -21,7 +21,7 @@ import pytest
from airflow.utils.session import provide_session
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
class TestSession:
diff --git a/tests/utils/test_sqlalchemy.py b/tests/utils/test_sqlalchemy.py
index 1cff070795..bd4a9763e1 100644
--- a/tests/utils/test_sqlalchemy.py
+++ b/tests/utils/test_sqlalchemy.py
@@ -43,7 +43,7 @@ from airflow.utils.sqlalchemy import (
from airflow.utils.state import State
from airflow.utils.timezone import utcnow
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
TEST_POD =
k8s.V1Pod(spec=k8s.V1PodSpec(containers=[k8s.V1Container(name="base")]))
diff --git a/tests/utils/test_state.py b/tests/utils/test_state.py
index 43c5019f52..e00ba36fe3 100644
--- a/tests/utils/test_state.py
+++ b/tests/utils/test_state.py
@@ -25,7 +25,7 @@ from airflow.utils.state import DagRunState
from airflow.utils.types import DagRunType
from tests.models import DEFAULT_DATE
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
def test_dagrun_state_enum_escape():
diff --git a/tests/utils/test_types.py b/tests/utils/test_types.py
index d0543c6130..61a1f94c08 100644
--- a/tests/utils/test_types.py
+++ b/tests/utils/test_types.py
@@ -25,7 +25,7 @@ from airflow.utils.state import State
from airflow.utils.types import DagRunType
from tests.models import DEFAULT_DATE
-pytestmark = pytest.mark.db_test
+pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode]
def test_runtype_enum_escape():
diff --git a/tests/utils/test_usage_data_collection.py
b/tests/utils/test_usage_data_collection.py
index bb7710e88f..5244de1a58 100644
--- a/tests/utils/test_usage_data_collection.py
+++ b/tests/utils/test_usage_data_collection.py
@@ -69,6 +69,7 @@ def test_scarf_analytics(
mock_get.assert_called_once_with(expected_scarf_url, timeout=5.0)
[email protected]_if_database_isolation_mode
@pytest.mark.db_test
@pytest.mark.parametrize(
"version_info, expected_version",