diff options
author | Heckad <heckad@yandex.ru> | 2020-01-01 14:47:01 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-01-03 13:09:46 -0500 |
commit | a076b1f30406cbb59a55e2c01ddd17a84636778e (patch) | |
tree | bb4c5a5b88d45963040842427d73f9616465bdb0 /test/engine/test_pool.py | |
parent | 748bf710fdeeed327933a5e7c277c7f79f6053a6 (diff) | |
download | sqlalchemy-a076b1f30406cbb59a55e2c01ddd17a84636778e.tar.gz |
Use context managers for threading.Lock()
(zzzeek:) For some reason I thought that threading.Lock() still did
not support context managers, at least in Python 2, however this
does not seem to be the case.
Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Closes: #5069
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5069
Pull-request-sha: efeac06dda5afdbe33abcf9b27c8b5b5725c8444
Change-Id: Ic64fcd99cd587bc70b4ecc5b45d8205b5c76eff2
Diffstat (limited to 'test/engine/test_pool.py')
-rw-r--r-- | test/engine/test_pool.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/test/engine/test_pool.py b/test/engine/test_pool.py index 31b893734..e4d6dba57 100644 --- a/test/engine/test_pool.py +++ b/test/engine/test_pool.py @@ -970,11 +970,8 @@ class QueuePoolTest(PoolTestBase): dbapi = MockDBAPI() def creator(): - mutex.acquire() - try: + with mutex: return dbapi.connect() - finally: - mutex.release() success = [] for timeout in (None, 30): |