Fix the import_crypto_module helper and factor some str/unicode helpers into the test util module
diff --git a/OpenSSL/test/util.py b/OpenSSL/test/util.py
index bbe8492..61246a6 100644
--- a/OpenSSL/test/util.py
+++ b/OpenSSL/test/util.py
@@ -16,6 +16,17 @@
from OpenSSL.crypto import Error, _exception_from_error_queue
+try:
+ bytes = bytes
+except NameError:
+ def b(s):
+ return s
+ bytes = str
+else:
+ def b(s):
+ return s.encode("ascii")
+
+
class TestCase(TestCase):
"""
L{TestCase} adds useful testing functionality beyond what is available