summaryrefslogtreecommitdiff
path: root/tests/test_setmulti.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-11-04 19:56:57 -0400
committerTim Graham <timograham@gmail.com>2017-11-14 14:33:26 -0500
commit2e9dcfbb8efb8726468b02a2ed79f01a18ec2c26 (patch)
treebbfe781084a50e9da5e7bf18732625acce8103cd /tests/test_setmulti.py
parenta565216013a98b23996de97bc3324992a278011d (diff)
downloadpython-memcached-2e9dcfbb8efb8726468b02a2ed79f01a18ec2c26.tar.gz
Capture and verify logging in tests
Diffstat (limited to 'tests/test_setmulti.py')
-rw-r--r--tests/test_setmulti.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/test_setmulti.py b/tests/test_setmulti.py
index 3cc1591..756afe8 100644
--- a/tests/test_setmulti.py
+++ b/tests/test_setmulti.py
@@ -13,6 +13,8 @@ import socket
import sys
import unittest
+from .utils import captured_stderr
+
sys.path.append('..')
import memcache # noqa: E402
@@ -60,10 +62,10 @@ class test_Memcached_Set_Multi(unittest.TestCase):
def test_Socket_Disconnect(self):
mapping = {'foo': 'FOO', 'bar': 'BAR'}
- bad_keys = self.mc.set_multi(mapping)
-
+ with captured_stderr() as log:
+ bad_keys = self.mc.set_multi(mapping)
+ self.assertIn('connection closed in readline().', log.getvalue())
self.assertEqual(sorted(bad_keys), ['bar', 'foo'])
-
if DEBUG:
print('set_multi({0!r}) -> {1!r}'.format(mapping, bad_keys))