Skip to content

Commit

Permalink
Add regression test for #390
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicoretti committed Nov 2, 2023
1 parent f7be0ea commit 52e579b
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/integration/regression/test_regression_bug390.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from inspect import cleandoc

pytest_plugins = "pytester"


def test_connection_with_block_cleans_up_properly(pytester, itde):
config = itde.db
# Because the error only occurs on process shutdown we need to run a test within a test
# (We require the result (stderr) of a terminated process triggering the failure.
pytester.makepyfile(
# fmt: off
cleandoc(
f"""
from sqlalchemy import create_engine
def test():
url = "exa+websocket://{{user}}:{{pw}}@{{host}}:{{port}}/{{schema}}?SSLCertificate=SSL_VERIFY_NONE"
url = url.format(
user="{config.username}",
pw="{config.password}",
host="{config.host}",
port={config.port},
schema="{itde.itde.schemas[0]}",
)
engine = create_engine(url)
query = "SELECT 42;"
with engine.connect() as con:
result = con.execute(query).fetchall()
"""
),
# fmt: on
)
r = pytester.runpytest_subprocess()
assert str(r.stderr) == ""

0 comments on commit 52e579b

Please sign in to comment.