Skip to content

Commit 96ce66d

Browse files
fix: simplify Snowflake connection fixture by removing unnecessary patching
1 parent b20bb9d commit 96ce66d

1 file changed

Lines changed: 4 additions & 19 deletions

File tree

tests/unit_tests/snowflake/test__execute_sql.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Functional test for _execute_sql."""
22

33
from typing import Generator
4-
from unittest.mock import MagicMock
54

65
import pytest
76
from snowflake.connector import SnowflakeConnection
@@ -11,25 +10,11 @@
1110

1211

1312
@pytest.fixture(scope="module")
14-
def patched_current() -> Generator[MagicMock, None, None]:
15-
"""Patch Metaflow `current` object for modules used in this test file."""
16-
mock_current = MagicMock("metaflow.current")
17-
mock_current.tags = ["ds.domain:testing", "ds.project:unit-tests"]
18-
mock_current.flow_name = "DummyFlow"
19-
mock_current.project_name = "dummy-project"
20-
mock_current.step_name = "dummy-step"
21-
mock_current.run_id = "123"
22-
mock_current.username = "tester"
23-
mock_current.is_production = False
24-
mock_current.namespace = "user:tester"
25-
mock_current.is_running_flow = True
26-
mock_current.card = []
27-
yield mock_current
28-
29-
30-
@pytest.fixture(scope="module")
31-
def snowflake_conn(patched_current) -> Generator[SnowflakeConnection, None, None]:
13+
def snowflake_conn() -> Generator[SnowflakeConnection, None, None]:
3214
"""Get a Snowflake connection for testing."""
15+
from metaflow import current
16+
17+
current.is_production = False # Ensure we're in non-prod for testing
3318
yield get_snowflake_connection(warehouse=None, use_utc=True)
3419

3520

0 commit comments

Comments
 (0)