[packages/python-testtools/py3-without-backports] - added deps patch (don't use backports under python 3.5+) - added tests-nosource patch (adjust test
qboosh
qboosh at pld-linux.org
Thu Jan 9 20:16:07 CET 2020
commit 64dfe9b280e1af7823a4a8d1ea69860dcf0bd7e0
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Thu Jan 9 20:15:15 2020 +0100
- added deps patch (don't use backports under python 3.5+)
- added tests-nosource patch (adjust tests for case when module sources are not available)
python-testtools-deps.patch | 124 ++++++++++++++++++++++++++++++++++
python-testtools-tests-nosource.patch | 15 ++++
python-testtools.spec | 85 ++++++++++++++++-------
3 files changed, 198 insertions(+), 26 deletions(-)
---
diff --git a/python-testtools.spec b/python-testtools.spec
index f1d6084..fa79620 100644
--- a/python-testtools.spec
+++ b/python-testtools.spec
@@ -12,39 +12,52 @@ Version: 2.3.0
Release: 2
License: MIT
Group: Development/Tools
-#Source0Download: https://pypi.python.org/pypi/testtools
-Source0: https://pypi.python.org/packages/source/t/testtools/testtools-%{version}.tar.gz
+#Source0Download: https://pypi.org/simple/testtools/
+Source0: https://files.pythonhosted.org/packages/source/t/testtools/testtools-%{version}.tar.gz
# Source0-md5: 0f0feb915497816cb99e39437494217e
+Patch0: %{name}-deps.patch
+Patch1: %{name}-tests-nosource.patch
URL: https://github.com/testing-cabal/testtools
%if %{with python2}
-BuildRequires: python-devel >= 1:2.6
+BuildRequires: python-devel >= 1:2.7
+BuildRequires: python-pbr >= 0.11
BuildRequires: python-setuptools
%if %{with tests}
-BuildRequires: python-devel-tools
-BuildRequires: python-extras
-BuildRequires: python-fixtures
+BuildRequires: python-devel-tools >= 1:2.7
+BuildRequires: python-extras >= 1.0.0
+BuildRequires: python-fixtures >= 1.3.0
BuildRequires: python-mimeparse
BuildRequires: python-modules
+BuildRequires: python-six >= 1.4.0
+BuildRequires: python-testresources
+BuildRequires: python-testscenarios
BuildRequires: python-testtools
BuildRequires: python-traceback2
+BuildRequires: python-unittest2 >= 1.0.0
%endif
%endif
%if %{with python3}
-BuildRequires: python3-devel >= 1:3.2
+BuildRequires: python3-devel >= 1:3.3
+BuildRequires: python3-pbr >= 0.11
BuildRequires: python3-setuptools
%if %{with tests}
-BuildRequires: python3-devel-tools
-BuildRequires: python3-extras
-BuildRequires: python3-fixtures
+BuildRequires: python3-devel-tools >= 1:3.3
+BuildRequires: python3-extras >= 1.0.0
+BuildRequires: python3-fixtures >= 1.3.0
BuildRequires: python3-mimeparse
+BuildRequires: python3-six >= 1.4.0
+BuildRequires: python3-testresources
+BuildRequires: python3-testscenarios
BuildRequires: python3-testtools
+%if "%{py3_ver}" < "3.5"
BuildRequires: python3-traceback2
-BuildRequires: python3-unittest2
+BuildRequires: python3-unittest2 >= 1.0.0
+%endif
%endif
%endif
BuildRequires: rpmbuild(macros) >= 1.714
+BuildRequires: sed >= 4.0
%{?with_doc:BuildRequires: sphinx-pdg}
-Requires: python-extras
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -60,7 +73,6 @@ biblioteki standardowej Pythona.
Summary: Extensions to the Python unit testing framework
Summary(pl.UTF-8): Rozszerzenie szkieletu testów jednostkowych Pythona
Group: Development/Tools
-Requires: python3-extras
%description -n python3-testtools
testtools is a set of extensions to the Python standard library's unit
@@ -71,27 +83,37 @@ testtools to zestaw rozszerzeń szkieletu testów jednostkowych z
biblioteki standardowej Pythona.
%package doc
-Summary: Documentation for %{name}
-Summary(pl.UTF-8): Dokumentacja do pakietu %{name}
+Summary: Documentation for Python testttools module
+Summary(pl.UTF-8): Dokumentacja do pakietu Pythona testttools
Group: Documentation
Requires: %{name} = %{version}-%{release}
%description doc
-This package contains HTML documentation for %{name}.
+This package contains HTML documentation for Python testttools module.
%description doc -l pl.UTF-8
-Dokumentacja HTML do pakietu %{name}.
+Dokumentacja HTML do pakietu Pythona testttools.
%prep
%setup -q -n testtools-%{version}
+%patch0 -p1
+%patch1 -p1
%build
%if %{with python2}
-%py_build %{?with_tests:test}
+%py_build
+
+%if %{with tests}
+%{__python} -m testtools.run testtools.tests.test_suite
+%endif
%endif
%if %{with python3}
-%py3_build %{?with_tests:test}
+%py3_build
+
+%if %{with tests}
+%{__python3} -m testtools.run testtools.tests.test_suite
+%endif
%endif
%if %{with doc}
@@ -104,17 +126,28 @@ rm -rf $RPM_BUILD_ROOT
%if %{with python2}
%py_install
+%{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/testtools/tests/{matchers,twistedsupport}
+%{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/testtools/tests/{__init__,samplecases,test_*}.py*
+
+# replace selftests __init__ by empty stub
+touch $RPM_BUILD_ROOT%{py_sitescriptdir}/testtools/tests/__init__.py
+%py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}/testtools/tests
+%py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}/testtools/tests
+
%py_postclean
-%{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/testtools/tests/matchers
-%{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/testtools/tests/{__init__,test_*}.py*
%endif
%if %{with python3}
%py3_install
-%{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/testtools/tests/matchers
-%{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/testtools/tests/{__init__,test_*}.py* \
- $RPM_BUILD_ROOT%{py3_sitescriptdir}/testtools/tests/__pycache__/{__init__,test_*}.*.py*
+%{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/testtools/tests/{matchers,twistedsupport}
+%{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/testtools/tests/{__init__,samplecases,test_*}.py* \
+ $RPM_BUILD_ROOT%{py3_sitescriptdir}/testtools/tests/__pycache__/{__init__,samplecases,test_*}.*.py*
+
+# replace selftests __init__ by empty stub
+touch $RPM_BUILD_ROOT%{py3_sitescriptdir}/testtools/tests/__init__.py
+%py3_comp $RPM_BUILD_ROOT%{py3_sitescriptdir}/testtools/tests
+%py3_ocomp $RPM_BUILD_ROOT%{py3_sitescriptdir}/testtools/tests
%endif
%clean
@@ -123,7 +156,7 @@ rm -rf $RPM_BUILD_ROOT
%if %{with python2}
%files
%defattr(644,root,root,755)
-%doc LICENSE NEWS README.rst
+%doc AUTHORS ChangeLog LICENSE NEWS README.rst
%dir %{py_sitescriptdir}/testtools
%{py_sitescriptdir}/testtools/*.py[co]
%{py_sitescriptdir}/testtools/matchers
@@ -136,7 +169,7 @@ rm -rf $RPM_BUILD_ROOT
%if %{with python3}
%files -n python3-testtools
%defattr(644,root,root,755)
-%doc LICENSE NEWS README.rst
+%doc AUTHORS ChangeLog LICENSE NEWS README.rst
%dir %{py3_sitescriptdir}/testtools
%{py3_sitescriptdir}/testtools/*.py
%{py3_sitescriptdir}/testtools/__pycache__
diff --git a/python-testtools-deps.patch b/python-testtools-deps.patch
new file mode 100644
index 0000000..41643ae
--- /dev/null
+++ b/python-testtools-deps.patch
@@ -0,0 +1,124 @@
+--- testtools-2.3.0/testtools/compat.py.orig 2016-10-22 19:21:40.000000000 +0200
++++ testtools-2.3.0/testtools/compat.py 2018-07-25 20:13:12.616477384 +0200
+@@ -23,7 +23,6 @@
+ import os
+ import re
+ import sys
+-import traceback
+ import unicodedata
+
+ from extras import try_import, try_imports
+@@ -31,7 +30,8 @@
+ BytesIO = try_imports(['StringIO.StringIO', 'io.BytesIO'])
+ StringIO = try_imports(['StringIO.StringIO', 'io.StringIO'])
+ # To let setup.py work, make this a conditional import.
+-linecache = try_import('linecache2')
++linecache = try_imports(['linecache2', 'linecache'])
++traceback = try_imports(['traceback2', 'traceback'])
+
+ try:
+ from testtools import _compat2x as _compat
+--- testtools-2.3.0/testtools/content.py.orig 2018-07-25 20:42:06.519790918 +0200
++++ testtools-2.3.0/testtools/content.py 2018-07-25 20:42:17.726457457 +0200
+@@ -20,7 +20,7 @@
+
+-from extras import try_import
++from extras import try_import, try_imports
+ # To let setup.py work, make this a conditional import.
+-traceback = try_import('traceback2')
++traceback = try_imports(['traceback2', 'traceback'])
+
+ from testtools.compat import (
+ _b,
+--- testtools-2.3.0/requirements.txt.orig 2016-10-22 19:21:40.000000000 +0200
++++ testtools-2.3.0/requirements.txt 2018-07-25 20:43:58.353122975 +0200
+@@ -4,6 +4,6 @@
+ # 'mimeparse' has not been uploaded by the maintainer with Python3 compat
+ # but someone kindly uploaded a fixed version as 'python-mimeparse'.
+ python-mimeparse
+-unittest2>=1.0.0
+-traceback2
++unittest2>=1.0.0; python_version<"3.5"
++traceback2; python_version<"3.5"
+ six>=1.4.0
+--- testtools-2.3.0/testtools/tests/test_testsuite.py.orig 2018-07-25 20:46:29.929787912 +0200
++++ testtools-2.3.0/testtools/tests/test_testsuite.py 2018-07-25 20:46:33.316454540 +0200
+@@ -5,9 +5,9 @@
+ import doctest
+ from pprint import pformat
+ import unittest
+-import unittest2
+
+-from extras import try_import
++from extras import try_import, try_imports
++unittest2 = try_imports(['unittest2', 'unittest'])
+
+ from testtools import (
+ ConcurrentTestSuite,
+--- testtools-2.3.0/testtools/tests/test_run.py.orig 2016-10-22 19:21:40.000000000 +0200
++++ testtools-2.3.0/testtools/tests/test_run.py 2018-07-25 20:50:49.796451611 +0200
+@@ -7,10 +7,10 @@
+ import sys
+ from textwrap import dedent
+
+-from extras import try_import
++from extras import try_import, try_imports
+ fixtures = try_import('fixtures')
+ testresources = try_import('testresources')
+-import unittest2
++unittest2 = try_imports(['unittest2', 'unittest'])
+
+ import testtools
+ from testtools import TestCase, run, skipUnless
+--- testtools-2.3.0/testtools/tests/twistedsupport/test_deferred.py.orig 2016-10-22 19:21:40.000000000 +0200
++++ testtools-2.3.0/testtools/tests/twistedsupport/test_deferred.py 2018-07-25 20:51:43.476450997 +0200
+@@ -52,5 +52,8 @@
+
+
+ def test_suite():
+- from unittest2 import TestLoader, TestSuite
++ try:
++ from unittest2 import TestLoader, TestSuite
++ except ImportError:
++ from unittest import TestLoader, TestSuite
+ return TestLoader().loadTestsFromName(__name__)
+--- testtools-2.3.0/testtools/tests/twistedsupport/test_matchers.py.orig 2016-10-22 19:21:40.000000000 +0200
++++ testtools-2.3.0/testtools/tests/twistedsupport/test_matchers.py 2018-07-25 21:06:30.283107538 +0200
+@@ -205,5 +205,8 @@
+
+
+ def test_suite():
+- from unittest2 import TestLoader, TestSuite
++ try:
++ from unittest2 import TestLoader, TestSuite
++ except ImportError:
++ from unittest import TestLoader, TestSuite
+ return TestLoader().loadTestsFromName(__name__)
+--- testtools-2.3.0/testtools/tests/twistedsupport/test_runtest.py.orig 2016-10-22 19:21:40.000000000 +0200
++++ testtools-2.3.0/testtools/tests/twistedsupport/test_runtest.py 2018-07-25 21:06:50.219773978 +0200
+@@ -1016,7 +1016,10 @@
+
+
+ def test_suite():
+- from unittest2 import TestLoader, TestSuite
++ try:
++ from unittest2 import TestLoader, TestSuite
++ except ImportError:
++ from unittest import TestLoader, TestSuite
+ return TestLoader().loadTestsFromName(__name__)
+
+
+--- testtools-2.3.0/testtools/tests/test_compat.py.orig 2016-10-22 19:21:40.000000000 +0200
++++ testtools-2.3.0/testtools/tests/test_compat.py 2018-07-26 18:57:49.558875829 +0200
+@@ -3,7 +3,10 @@
+ """Tests for miscellaneous compatibility functions"""
+
+ import io
+-import linecache2 as linecache
++try:
++ import linecache2 as linecache
++except ImportError:
++ import linecache
+ import os
+ import sys
+ import tempfile
diff --git a/python-testtools-tests-nosource.patch b/python-testtools-tests-nosource.patch
new file mode 100644
index 0000000..0e9bad5
--- /dev/null
+++ b/python-testtools-tests-nosource.patch
@@ -0,0 +1,15 @@
+--- testtools-2.3.0/testtools/tests/test_run.py.orig 2018-07-26 18:36:38.072223680 +0200
++++ testtools-2.3.0/testtools/tests/test_run.py 2018-07-26 18:56:54.098876462 +0200
+@@ -204,10 +204,8 @@
+ unittest2.loader._FailedTest.runexample
+ Failed to import test module: runexample
+ Traceback (most recent call last):
+- File ".../loader.py", line ..., in _find_test_path
+- package = self._get_module_from_name(name)
+- File ".../loader.py", line ..., in _get_module_from_name
+- __import__(name)
++ File ".../loader.py", line ..., in _find_test_path...
++ File ".../loader.py", line ..., in _get_module_from_name...
+ File ".../runexample/__init__.py", line 1
+ class not in
+ ...^...
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-testtools.git/commitdiff/64dfe9b280e1af7823a4a8d1ea69860dcf0bd7e0
More information about the pld-cvs-commit
mailing list