Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove import from MySQL provider tests in generic transfer test #46274

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

from airflow.exceptions import AirflowProviderDeprecationWarning
from airflow.models.dag import DAG
from airflow.providers.mysql.hooks.mysql import MySqlHook
potiuk marked this conversation as resolved.
Show resolved Hide resolved
from airflow.providers.postgres.hooks.postgres import PostgresHook
from airflow.utils import timezone

Expand Down Expand Up @@ -65,7 +66,17 @@ def teardown_method(self):
],
)
def test_mysql_to_mysql(self, client):
from providers.tests.mysql.hooks.test_mysql import MySqlContext
class MySqlContext:
def __init__(self, client):
self.client = client
self.connection = MySqlHook.get_connection(MySqlHook.default_conn_name)
self.init_client = self.connection.extra_dejson.get("client", "mysqlclient")

def __enter__(self):
self.connection.set_extra(f'{{"client": "{self.client}"}}')

def __exit__(self, exc_type, exc_val, exc_tb):
self.connection.set_extra(f'{{"client": "{self.init_client}"}}')

with MySqlContext(client):
sql = "SELECT * FROM connection;"
Expand Down