summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorOmer Katz <omer.drow@gmail.com>2019-03-19 09:53:06 +0200
committerOmer Katz <omer.drow@gmail.com>2019-03-19 09:53:06 +0200
commitd760002e256f0a488c436d0d57e5896adb162d7b (patch)
treee5ccfa63a37e0df730089ee19f761ed486edf84c /t
parentf08e2106eed9878e73d7d553473226d9c74c7d3d (diff)
downloadpy-amqp-threadsafty.tar.gz
Added a test that proves that amqp is not threadsafe.threadsafty
Diffstat (limited to 't')
-rw-r--r--t/integration/test_rmq.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/integration/test_rmq.py b/t/integration/test_rmq.py
index e5f0496..71ecaf3 100644
--- a/t/integration/test_rmq.py
+++ b/t/integration/test_rmq.py
@@ -1,6 +1,8 @@
from __future__ import absolute_import, unicode_literals
import os
+import threading
+import logging
import pytest
@@ -146,3 +148,21 @@ class test_rabbitmq_operations():
queue='py-amqp-unittest',
)
assert msg is None
+
+
+def test_threadsafty(caplog, connection):
+ caplog.set_level(logging.DEBUG)
+ connection.connect()
+
+ def worker():
+ connection.channel()
+
+ threads = [threading.Thread(target=worker) for _ in range(2)]
+
+ for t in threads:
+ t.start()
+
+ for t in threads:
+ t.join(timeout=30)
+
+ connection.close()