Skip to content

Commit 68cbcaf

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

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
@@ -24,7 +24,7 @@
2424

2525
# TODO(http://github.com/googleapis/google-cloud-python/issues/17287): Unskip once bug is resolved.
2626
@pytest.mark.skip(reason="Failing in CI with AssertionError.")
27-
def test_geoalchemy2_core(bigquery_dataset):
27+
def test_geoalchemy2_core(engine, bigquery_dataset):
2828
"""Make sure GeoAlchemy 2 Core Tutorial works as adapted to only having geography
2929
3030
https://geoalchemy-2.readthedocs.io/en/latest/core_tutorial.html
@@ -34,12 +34,6 @@ def test_geoalchemy2_core(bigquery_dataset):
3434
- Bigquery doesn't have ST_BUFFER
3535
"""
3636

37-
# Connect to the DB
38-
39-
from sqlalchemy import create_engine
40-
41-
engine = create_engine(f"bigquery:///{bigquery_dataset}")
42-
4337
# Create the Table
4438

4539
from sqlalchemy import Column, MetaData, String, Table
@@ -143,18 +137,12 @@ def test_geoalchemy2_core(bigquery_dataset):
143137

144138
# TODO(http://github.com/googleapis/google-cloud-python/issues/17287): Unskip once bug is resolved.
145139
@pytest.mark.skip(reason="Failing in CI with AssertionError.")
146-
def test_geoalchemy2_orm(bigquery_dataset):
140+
def test_geoalchemy2_orm(engine, bigquery_dataset):
147141
"""Make sure GeoAlchemy 2 ORM Tutorial works as adapted to only having geometry
148142
149143
https://geoalchemy-2.readthedocs.io/en/latest/orm_tutorial.html
150144
"""
151145

152-
# Connect to the DB
153-
154-
from sqlalchemy import create_engine
155-
156-
engine = create_engine(f"bigquery:///{bigquery_dataset}")
157-
158146
# Declare a Mapping
159147

160148
from sqlalchemy import Column, Integer, String
@@ -260,10 +248,7 @@ class Lake(Base):
260248

261249
# TODO(http://github.com/googleapis/google-cloud-python/issues/17287): Unskip once bug is resolved.
262250
@pytest.mark.skip(reason="Failing in CI with AssertionError.")
263-
def test_geoalchemy2_orm_w_relationship(bigquery_dataset):
264-
from sqlalchemy import create_engine
265-
266-
engine = create_engine(f"bigquery:///{bigquery_dataset}")
251+
def test_geoalchemy2_orm_w_relationship(engine, bigquery_dataset):
267252

268253
from sqlalchemy import Column, Integer, String
269254
from sqlalchemy.ext.declarative import declarative_base

0 commit comments

Comments
 (0)