summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Chan <alex@alexwlchan.net>2016-10-24 16:47:39 +0100
committerHynek Schlawack <hs@ox.cx>2016-10-24 17:47:39 +0200
commit67666e2fcdaf8ccd4c4694bcc2d921a7ef7db02e (patch)
tree23b3663b964cee48d1bbd03266ca109301d9bcaf
parent6b69c55372a390ca350fd6d2749452ffe3f55049 (diff)
downloadpyopenssl-67666e2fcdaf8ccd4c4694bcc2d921a7ef7db02e.tar.gz
Convert test_util to use pytest-style tests (#562)
Fix up the assert helpers, subclass from `object` rather than `TestCase`, and then I had to rename the class -- pytest doesn't pick it up with the original name. Addresses #340.
-rw-r--r--tests/test_util.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/test_util.py b/tests/test_util.py
index 2aaded2..78c97b5 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -1,9 +1,9 @@
from OpenSSL._util import exception_from_error_queue, lib
-from .util import TestCase
+import pytest
-class ErrorTests(TestCase):
+class TestErrors(object):
"""
Tests for handling of certain OpenSSL error cases.
"""
@@ -13,7 +13,6 @@ class ErrorTests(TestCase):
encounters an OpenSSL error code which does not have a reason string.
"""
lib.ERR_put_error(lib.ERR_LIB_EVP, 0, 1112, b"", 10)
- exc = self.assertRaises(
- ValueError, exception_from_error_queue, ValueError
- )
- self.assertEqual(exc.args[0][0][2], "")
+ with pytest.raises(ValueError) as exc:
+ exception_from_error_queue(ValueError)
+ assert exc.value.args[0][0][2] == ""