From d3a0b1eac61d1185fc6df422d202ec3a8114f3a8 Mon Sep 17 00:00:00 2001 From: Nathaniel McCallum Date: Wed, 4 Mar 2015 12:16:31 -0500 Subject: [PATCH] Fix test execution --- python-cryptography-0.7.2-testspath.patch | 39 +++++++++++++++++++++++ python-cryptography.spec | 6 +++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 python-cryptography-0.7.2-testspath.patch diff --git a/python-cryptography-0.7.2-testspath.patch b/python-cryptography-0.7.2-testspath.patch new file mode 100644 index 0000000..24ad4e1 --- /dev/null +++ b/python-cryptography-0.7.2-testspath.patch @@ -0,0 +1,39 @@ +From e8179e79bcb1d8d6e09fffe8e0123afce09ce02d Mon Sep 17 00:00:00 2001 +From: Donald Stufft +Date: Thu, 19 Feb 2015 22:37:49 -0500 +Subject: [PATCH] Pass the sys.path into the subprocess + +If we're running tests via ``python setup.py test`` in a clean +environment then all of our dependencies are going to be installed +into either the current directory or the .eggs directory. However the +subprocess won't know to activate these dependencies, so we'll get it +to do so by passing our entire sys.path into the subprocess via the +PYTHONPATH environment variable. +--- + tests/hazmat/backends/test_openssl.py | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py +index 2bf66a0..0e4d75e 100644 +--- a/tests/hazmat/backends/test_openssl.py ++++ b/tests/hazmat/backends/test_openssl.py +@@ -234,9 +234,19 @@ def test_osrandom_engine_is_default(self, tmpdir): + ) + engine_name = tmpdir.join('engine_name') + ++ # If we're running tests via ``python setup.py test`` in a clean ++ # environment then all of our dependencies are going to be installed ++ # into either the current directory or the .eggs directory. However the ++ # subprocess won't know to activate these dependencies, so we'll get it ++ # to do so by passing our entire sys.path into the subprocess via the ++ # PYTHONPATH environment variable. ++ env = os.environ.copy() ++ env["PYTHONPATH"] = os.pathsep.join(sys.path) ++ + with engine_name.open('w') as out: + subprocess.check_call( + [sys.executable, "-c", engine_printer], ++ env=env, + stdout=out + ) + diff --git a/python-cryptography.spec b/python-cryptography.spec index 3509f1f..6593610 100644 --- a/python-cryptography.spec +++ b/python-cryptography.spec @@ -14,6 +14,7 @@ Group: Development/Libraries License: ASL 2.0 or BSD URL: https://cryptography.io/en/latest/ Source0: https://pypi.python.org/packages/source/c/cryptography/cryptography-%{version}.tar.gz +Patch0: python-cryptography-0.7.2-testspath.patch BuildRequires: openssl-devel BuildRequires: python2-devel python-setuptools python-cffi >= 0.8 python-six @@ -49,6 +50,7 @@ recipes to Python developers. %prep %setup -q -n cryptography-%{version} +%patch0 -p1 %if 0%{?with_python3} rm -rf %{py3dir} @@ -85,7 +87,7 @@ popd %if 0%{?with_python3} pushd %{py3dir} -%{__python3} setup.py install --skip-build --prefix=%{_prefix} --root %{buildroot} +%{__python3} setup.py test popd %endif @@ -105,6 +107,8 @@ popd %changelog * Tue Feb 03 2015 Nathaniel McCallum - 0.7.2-1 - New upstream release. BSD is now an optional license. +- Fix test running on python3 +- Add upstream patch to fix test paths * Fri Nov 07 2014 Matej Cepl - 0.6.1-2 - Fix requires, for reasons why other development files were not