diff --git a/tests/common_fixtures.py b/tests/common_fixtures.py index 5829d13..e61dbbe 100644 --- a/tests/common_fixtures.py +++ b/tests/common_fixtures.py @@ -117,8 +117,11 @@ def spark_session(pyspark_session: PySparkSession) -> SparkSession: @pytest.fixture(scope="function") def duckdb_session() -> DuckDBSession: - connection = duckdb.connect(config={"TimeZone": "UTC"}) - return DuckDBSession(conn=connection) + connector = duckdb.connect() + connector.execute("set TimeZone = 'UTC'") + connector.execute("SELECT * FROM duckdb_settings() WHERE name = 'TimeZone'") + assert connector.fetchone()[1] == "UTC" # type: ignore + return DuckDBSession(conn=connector) @pytest.fixture diff --git a/tests/integration/engines/duck/test_duckdb_catalog.py b/tests/integration/engines/duck/test_duckdb_catalog.py index e464b63..05d8481 100644 --- a/tests/integration/engines/duck/test_duckdb_catalog.py +++ b/tests/integration/engines/duck/test_duckdb_catalog.py @@ -8,7 +8,8 @@ def duckdb_session() -> DuckDBSession: import duckdb - connector = duckdb.connect(config={"TimeZone": "UTC"}) + connector = duckdb.connect() + connector.sql("set TimeZone = 'UTC'") session = DuckDBSession(connector) session._execute('''ATTACH ':memory:' AS "default"''') session._execute('''ATTACH ':memory:' AS "catalog1"''') diff --git a/tests/integration/engines/test_int_functions.py b/tests/integration/engines/test_int_functions.py index 21e05b1..85ddf17 100644 --- a/tests/integration/engines/test_int_functions.py +++ b/tests/integration/engines/test_int_functions.py @@ -1498,7 +1498,7 @@ def test_last_day(get_session_and_func): def test_from_unixtime(get_session_and_func): session, from_unixtime = get_session_and_func("from_unixtime") df = session.createDataFrame([(1428476400,)], ["unix_time"]) - if isinstance(session, (BigQuerySession, DuckDBSession, PostgresSession, SnowflakeSession)): + if isinstance(session, (BigQuerySession, PostgresSession, SnowflakeSession)): expected = "2015-04-08 07:00:00" else: expected = "2015-04-08 00:00:00" @@ -1540,7 +1540,7 @@ def test_to_utc_timestamp(get_session_and_func): def test_timestamp_seconds(get_session_and_func): session, timestamp_seconds = get_session_and_func("timestamp_seconds") df = session.createDataFrame([(1230219000,)], ["unix_time"]) - if isinstance(session, (BigQuerySession, DuckDBSession, PostgresSession, SnowflakeSession)): + if isinstance(session, (BigQuerySession, PostgresSession, SnowflakeSession)): expected = datetime.datetime(2008, 12, 25, 15, 30, 00) else: expected = datetime.datetime(2008, 12, 25, 7, 30)