aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDavid Reid <dreid@dreid.org>2014-06-13 10:23:33 -0700
committerDavid Reid <dreid@dreid.org>2014-06-13 10:23:33 -0700
commit07de62c1ecf9c202a45a5c49b280c1df4eb3f685 (patch)
treec7de30613dd0cd12f780526efc287087e2fd41df /tests
parent19b70d2adb5f7b9c1903d7b69e580b4c1148f394 (diff)
downloadcryptography-07de62c1ecf9c202a45a5c49b280c1df4eb3f685.tar.gz
cryptography-07de62c1ecf9c202a45a5c49b280c1df4eb3f685.tar.bz2
cryptography-07de62c1ecf9c202a45a5c49b280c1df4eb3f685.zip
Attempt to better isolate this test by getting the backend name from a subprocess.
Diffstat (limited to 'tests')
-rw-r--r--tests/hazmat/backends/test_openssl.py32
1 files changed, 27 insertions, 5 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index aa2122fb..09a7f0a5 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -13,6 +13,10 @@
from __future__ import absolute_import, division, print_function
+import sys
+import subprocess
+import textwrap
+
import pretend
import pytest
@@ -215,11 +219,29 @@ class TestOpenSSLRandomEngine(object):
# This must be the first test in the class so that the teardown method
# has not (potentially) altered the default engine.
def test_osrandom_engine_is_default(self):
- e = backend._lib.ENGINE_get_default_RAND()
- name = backend._lib.ENGINE_get_name(e)
- assert name == backend._lib.Cryptography_osrandom_engine_name
- res = backend._lib.ENGINE_free(e)
- assert res == 1
+ engine_name = subprocess.check_output(
+ [sys.executable,
+ "-c",
+ textwrap.dedent(
+ """
+ import sys
+ from cryptography.hazmat.backends.openssl.backend import backend
+
+ e = backend._lib.ENGINE_get_default_RAND()
+ name = backend._lib.ENGINE_get_name(e)
+ sys.stdout.write(backend._ffi.string(name))
+ res = backend._lib.ENGINE_free(e)
+ assert res == 1
+ """
+ )
+ ]
+ )
+
+ osrandom_engine_name = backend._ffi.string(
+ backend._lib.Cryptography_osrandom_engine_name
+ )
+
+ assert engine_name == osrandom_engine_name
def test_osrandom_sanity_check(self):
# This test serves as a check against catastrophic failure.