From 45b8ff26d8ff55554c3e6dbfb13cf5b1e2b71331 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: May 29 2015 17:34:40 +0000 Subject: Run test suite in %check --- diff --git a/0001-Allow-verbosity-to-be-specified-when-running-test-su.patch b/0001-Allow-verbosity-to-be-specified-when-running-test-su.patch new file mode 100644 index 0000000..e4d13c8 --- /dev/null +++ b/0001-Allow-verbosity-to-be-specified-when-running-test-su.patch @@ -0,0 +1,34 @@ +From b6c85062b316ecd4606c64b449fe0c8ec5d2a708 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Fri, 29 May 2015 13:15:40 -0400 +Subject: [PATCH 1/2] Allow verbosity to be specified when running test suite + +--- + blosc/test.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/blosc/test.py b/blosc/test.py +index c7227451d9..0a12fb0107 100644 +--- a/blosc/test.py ++++ b/blosc/test.py +@@ -177,7 +177,7 @@ class TestCodec(unittest.TestCase): + self.assertRaises(TypeError, blosc.unpack_array, 1.0) + + +-def run(): ++def run(verbosity=2): + import blosc + import blosc.toplevel + blosc.print_versions() +@@ -187,7 +187,7 @@ def run(): + + # suite = unittest.TestLoader().discover(start_dir='.', pattern='test*.py') + suite.addTests(unittest.TestLoader().loadTestsFromModule(blosc.toplevel)) +- unittest.TextTestRunner(verbosity=2).run(suite) ++ unittest.TextTestRunner(verbosity=verbosity).run(suite) + + + if __name__ == '__main__': +-- +2.1.0 + diff --git a/0002-Propagate-the-result-of-tests.patch b/0002-Propagate-the-result-of-tests.patch new file mode 100644 index 0000000..a148166 --- /dev/null +++ b/0002-Propagate-the-result-of-tests.patch @@ -0,0 +1,28 @@ +From 16688ab07612e4f022b3118e7a18660ffdfcb106 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Fri, 29 May 2015 13:16:52 -0400 +Subject: [PATCH] Propagate the result of tests + +This way things like + python -c 'import sys, blosc; sys.exit(blosc.test())' +actually fail if tests fail. +--- + blosc/test.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/blosc/test.py b/blosc/test.py +index 0a12fb0107..760db66296 100644 +--- a/blosc/test.py ++++ b/blosc/test.py +@@ -187,7 +187,7 @@ def run(verbosity=2): + + # suite = unittest.TestLoader().discover(start_dir='.', pattern='test*.py') + suite.addTests(unittest.TestLoader().loadTestsFromModule(blosc.toplevel)) +- unittest.TextTestRunner(verbosity=verbosity).run(suite) ++ assert unittest.TextTestRunner(verbosity=verbosity).run(suite).wasSuccessful() + + + if __name__ == '__main__': +-- +2.1.0 + diff --git a/python-blosc.spec b/python-blosc.spec index 12f373f..7966f4e 100644 --- a/python-blosc.spec +++ b/python-blosc.spec @@ -11,12 +11,17 @@ Summary: Python wrapper for the blosc high performance compressor Name: python-%{module} Version: 1.2.7 -Release: 2%{?dist} +Release: 3%{?dist} License: MIT URL: https://github.com/FrancescAlted/python-blosc Source0: https://pypi.python.org/packages/source/b/%{module}/%{module}-%{version}.tar.gz +Patch0: 0001-Allow-verbosity-to-be-specified-when-running-test-su.patch +Patch1: 0002-Propagate-the-result-of-tests.patch + BuildRequires: blosc-devel BuildRequires: python2-devel +BuildRequires: numpy +Recommends: numpy %description Python wrapper for the Blosc high performance compressor. @@ -25,13 +30,15 @@ Python wrapper for the Blosc high performance compressor. %package -n python3-%{module} Summary: Python wrapper for the blosc high performance compressor BuildRequires: python3-devel +BuildRequires: python3-numpy +Recommends: python3-numpy %description -n python3-%{module} Python wrapper for the Blosc high performance compressor. %endif %prep -%setup -q -n %{module}-%{version} +%autosetup -n %{module}-%{version} -p1 # Don't enable SSE2 optimizations sed -i "s|CFLAGS\.append(\"-msse2\")|pass|" setup.py @@ -63,7 +70,17 @@ export BLOSC_DIR=%{_libdir}/blosc CFLAGS="%{optflags}" %doc README.rst RELEASE_NOTES.rst %endif +%check +cd / # avoid interference with build dir +PYTHONPATH=%{buildroot}%{python2_sitearch} python -c 'import sys, blosc; sys.exit(blosc.test())' +%if 0%{?with_python3} +PYTHONPATH=%{buildroot}%{python3_sitearch} python3 -c 'import sys, blosc; sys.exit(blosc.test())' +%endif + %changelog +* Fri May 29 2015 Zbigniew Jędrzejewski-Szmek - 1.2.7-3 +- Run test suite + * Thu May 28 2015 Zbigniew Jędrzejewski-Szmek - 1.2.7-2 - Build python 3 subpackage - Install license and readme files