Skip to content

Commit ab49ddd

Browse files
committed
perf(sqlalchemy-bigquery): reuse session-scoped engine in system geography tests
1 parent bf39f8b commit ab49ddd

1 file changed

Lines changed: 3 additions & 18 deletions

File tree

packages/sqlalchemy-bigquery/tests/system/test_geography.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
geoalchemy2 = pytest.importorskip("geoalchemy2")
2323

2424

25-
def test_geoalchemy2_core(bigquery_dataset):
25+
def test_geoalchemy2_core(engine, bigquery_dataset):
2626
"""Make sure GeoAlchemy 2 Core Tutorial works as adapted to only having geography
2727
2828
https://geoalchemy-2.readthedocs.io/en/latest/core_tutorial.html
@@ -32,12 +32,6 @@ def test_geoalchemy2_core(bigquery_dataset):
3232
- Bigquery doesn't have ST_BUFFER
3333
"""
3434

35-
# Connect to the DB
36-
37-
from sqlalchemy import create_engine
38-
39-
engine = create_engine(f"bigquery:///{bigquery_dataset}")
40-
4135
# Create the Table
4236

4337
from sqlalchemy import Column, MetaData, String, Table
@@ -137,18 +131,12 @@ def test_geoalchemy2_core(bigquery_dataset):
137131
)
138132

139133

140-
def test_geoalchemy2_orm(bigquery_dataset):
134+
def test_geoalchemy2_orm(engine, bigquery_dataset):
141135
"""Make sure GeoAlchemy 2 ORM Tutorial works as adapted to only having geometry
142136
143137
https://geoalchemy-2.readthedocs.io/en/latest/orm_tutorial.html
144138
"""
145139

146-
# Connect to the DB
147-
148-
from sqlalchemy import create_engine
149-
150-
engine = create_engine(f"bigquery:///{bigquery_dataset}")
151-
152140
# Declare a Mapping
153141

154142
from sqlalchemy import Column, Integer, String
@@ -252,10 +240,7 @@ class Lake(Base):
252240
]
253241

254242

255-
def test_geoalchemy2_orm_w_relationship(bigquery_dataset):
256-
from sqlalchemy import create_engine
257-
258-
engine = create_engine(f"bigquery:///{bigquery_dataset}")
243+
def test_geoalchemy2_orm_w_relationship(engine, bigquery_dataset):
259244

260245
from sqlalchemy import Column, Integer, String
261246
from sqlalchemy.ext.declarative import declarative_base

0 commit comments

Comments
 (0)