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 14c159b68d3 Remove pytestmark and add db_test marker to relevant tests
(#52140)
14c159b68d3 is described below
commit 14c159b68d3f792794ba048ffa0ae0e79ab12a78
Author: Yeonguk Choo <[email protected]>
AuthorDate: Tue Jun 24 19:19:55 2025 +0900
Remove pytestmark and add db_test marker to relevant tests (#52140)
---
providers/opsgenie/tests/unit/opsgenie/hooks/test_opsgenie.py | 4 ++--
.../opsgenie/tests/unit/opsgenie/notifications/test_opsgenie.py | 5 +++--
providers/opsgenie/tests/unit/opsgenie/typing/test_opsgenie.py | 4 ----
3 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/providers/opsgenie/tests/unit/opsgenie/hooks/test_opsgenie.py
b/providers/opsgenie/tests/unit/opsgenie/hooks/test_opsgenie.py
index ed166f3c971..0aafbfaaaa9 100644
--- a/providers/opsgenie/tests/unit/opsgenie/hooks/test_opsgenie.py
+++ b/providers/opsgenie/tests/unit/opsgenie/hooks/test_opsgenie.py
@@ -26,8 +26,6 @@ from opsgenie_sdk.exceptions import AuthenticationException
from airflow.models import Connection
from airflow.providers.opsgenie.hooks.opsgenie import OpsgenieAlertHook
-pytestmark = pytest.mark.db_test
-
class TestOpsgenieAlertHook:
conn_id = "opsgenie_conn_id_test"
@@ -83,6 +81,7 @@ class TestOpsgenieAlertHook:
api_key = hook._get_api_key()
assert api_key == "eb243592-faa2-4ba2-a551q-1afdf565c889"
+ @pytest.mark.db_test
def test_get_conn_defaults_host(self):
hook = OpsgenieAlertHook()
assert hook.get_conn().api_client.configuration.host ==
"https://api.opsgenie.com"
@@ -108,6 +107,7 @@ class TestOpsgenieAlertHook:
== "eb243592-faa2-4ba2-a551q-1afdf565c889"
)
+ @pytest.mark.db_test
def test_create_alert_api_key_not_set(self):
hook = OpsgenieAlertHook()
with pytest.raises(AuthenticationException):
diff --git
a/providers/opsgenie/tests/unit/opsgenie/notifications/test_opsgenie.py
b/providers/opsgenie/tests/unit/opsgenie/notifications/test_opsgenie.py
index feb397e4dcf..9f93ba7e609 100644
--- a/providers/opsgenie/tests/unit/opsgenie/notifications/test_opsgenie.py
+++ b/providers/opsgenie/tests/unit/opsgenie/notifications/test_opsgenie.py
@@ -25,8 +25,6 @@ from airflow.providers.opsgenie.hooks.opsgenie import
OpsgenieAlertHook
from airflow.providers.opsgenie.notifications.opsgenie import
OpsgenieNotifier, send_opsgenie_notification
from airflow.providers.standard.operators.empty import EmptyOperator
-pytestmark = pytest.mark.db_test
-
class TestOpsgenieNotifier:
_config = {
@@ -76,6 +74,7 @@ class TestOpsgenieNotifier:
}
@mock.patch.object(OpsgenieAlertHook, "get_conn")
+ @pytest.mark.db_test
def test_notifier(self, mock_opsgenie_alert_hook, dag_maker):
with dag_maker("test_notifier") as dag:
EmptyOperator(task_id="task1")
@@ -84,6 +83,7 @@ class TestOpsgenieNotifier:
mock_opsgenie_alert_hook.return_value.create_alert.assert_called_once_with(self.expected_payload_dict)
@mock.patch.object(OpsgenieAlertHook, "get_conn")
+ @pytest.mark.db_test
def test_notifier_with_notifier_class(self, mock_opsgenie_alert_hook,
dag_maker):
with dag_maker("test_notifier") as dag:
EmptyOperator(task_id="task1")
@@ -92,6 +92,7 @@ class TestOpsgenieNotifier:
mock_opsgenie_alert_hook.return_value.create_alert.assert_called_once_with(self.expected_payload_dict)
@mock.patch.object(OpsgenieAlertHook, "get_conn")
+ @pytest.mark.db_test
def test_notifier_templated(self, mock_opsgenie_alert_hook, dag_maker):
dag_id = "test_notifier"
with dag_maker(dag_id) as dag:
diff --git a/providers/opsgenie/tests/unit/opsgenie/typing/test_opsgenie.py
b/providers/opsgenie/tests/unit/opsgenie/typing/test_opsgenie.py
index b782305187f..c7f17dbae40 100644
--- a/providers/opsgenie/tests/unit/opsgenie/typing/test_opsgenie.py
+++ b/providers/opsgenie/tests/unit/opsgenie/typing/test_opsgenie.py
@@ -17,12 +17,8 @@
# under the License.
from __future__ import annotations
-import pytest
-
from airflow.providers.opsgenie.typing.opsgenie import CreateAlertPayload
-pytestmark = pytest.mark.db_test
-
class TestCreateAlertPayload:
def test_create_alert_payload_required_keys(self):