Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 17 additions & 0 deletions kubernetes-tests/tests/kubernetes_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,20 @@ def pod_template() -> Path:
@pytest.fixture
def basic_pod_template() -> Path:
return (DATA_FILES_DIRECTORY / "basic_pod.yaml").resolve(strict=True)


@pytest.fixture
def create_connection_without_db(monkeypatch):
"""
Fixture to create connections for tests without using the database.

This fixture uses monkeypatch to set the appropriate AIRFLOW_CONN_{conn_id} environment variable.
"""

def _create_conn(connection, session=None):
"""Create connection using environment variable."""

env_var_name = f"AIRFLOW_CONN_{connection.conn_id.upper()}"
monkeypatch.setenv(env_var_name, connection.as_json())

return _create_conn
Loading
Loading