summaryrefslogtreecommitdiff
path: root/tests/test_rand.py
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2017-10-03 19:03:42 +0200
committerMatěj Cepl <mcepl@cepl.eu>2018-02-05 22:25:07 +0100
commit58986b62898d86b1808bde46c991546b7ed5d437 (patch)
treed216ea6fb098aaa40190b9313de45386aa7bb93b /tests/test_rand.py
parent20b0d3058c5d10f8f6244ed7cc5160ef03d18724 (diff)
downloadm2crypto-58986b62898d86b1808bde46c991546b7ed5d437.tar.gz
For testing we need to use some deprecated functions.
And it makes output of testsuite run unreadable.
Diffstat (limited to 'tests/test_rand.py')
-rw-r--r--tests/test_rand.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/test_rand.py b/tests/test_rand.py
index 0cc6675..b44aa75 100644
--- a/tests/test_rand.py
+++ b/tests/test_rand.py
@@ -24,12 +24,14 @@ class RandTestCase(unittest.TestCase):
self.assertEqual(len(Rand.rand_bytes(1)), 1)
def test_pseudo_bytes(self):
- with self.assertRaises(MemoryError):
- Rand.rand_pseudo_bytes(-1)
- self.assertEqual(Rand.rand_pseudo_bytes(0), (b'', 1))
- a, b = Rand.rand_pseudo_bytes(1)
- self.assertEqual(len(a), 1)
- self.assertEqual(b, 1)
+ with warnings.catch_warnings():
+ warnings.simplefilter('ignore', DeprecationWarning)
+ with self.assertRaises(MemoryError):
+ Rand.rand_pseudo_bytes(-1)
+ self.assertEqual(Rand.rand_pseudo_bytes(0), (b'', 1))
+ a, b = Rand.rand_pseudo_bytes(1)
+ self.assertEqual(len(a), 1)
+ self.assertEqual(b, 1)
def test_file_name(self):
if os.name == 'nt':