Merge branch 'meihkv-master'
commit
24f13561f4
|
@ -425,6 +425,7 @@ Credits
|
|||
- Lucas Zeer for multi-line bugfixes for var substitution, ``<<``
|
||||
- vkk800 for ``--file``
|
||||
- Jens Albrecht for MySQL DatabaseError bugfix
|
||||
- meihkv for connection-closing bugfix
|
||||
|
||||
.. _Distribute: http://pypi.python.org/pypi/distribute
|
||||
.. _Buildout: http://www.buildout.org/
|
||||
|
|
|
@ -101,7 +101,8 @@ class Connection(object):
|
|||
template = " {}"
|
||||
result.append(template.format(engine_url.__repr__()))
|
||||
return "\n".join(result)
|
||||
|
||||
|
||||
@classmethod
|
||||
def _close(cls, descriptor):
|
||||
if isinstance(descriptor, Connection):
|
||||
conn = descriptor
|
||||
|
@ -114,7 +115,6 @@ class Connection(object):
|
|||
"Could not close connection because it was not found amongst these: %s"
|
||||
% str(cls.connections.keys())
|
||||
)
|
||||
cls.connections.pop(conn.name)
|
||||
cls.connections.pop(str(conn.metadata.bind.url))
|
||||
conn.session.close()
|
||||
|
||||
|
|
|
@ -370,6 +370,7 @@ def test_multiline_bracket_var_substitution(ip):
|
|||
""",
|
||||
)
|
||||
assert not result
|
||||
|
||||
|
||||
def test_json_in_select(ip):
|
||||
# Variable expansion does not work within json, but
|
||||
|
@ -387,3 +388,10 @@ def test_json_in_select(ip):
|
|||
)
|
||||
assert ('{"greeting": "Farewell sweet {person}"}',)
|
||||
|
||||
|
||||
def test_close_connection(ip):
|
||||
connections = runsql(ip, "%sql -l")
|
||||
connection_name = list(connections)[0]
|
||||
runsql(ip, f"%sql -x {connection_name}")
|
||||
connections_afterward = runsql(ip, "%sql -l")
|
||||
assert connection_name not in connections_afterward
|
||||
|
|
Loading…
Reference in New Issue