forked from pool/python-testtools
Accepting request 645918 from home:mcepl:work
- Remove requirements of unittest2 and linecache2 adding two additional patches remove-linecache2.patch and remove-unittest2.patch. OBS-URL: https://build.opensuse.org/request/show/645918 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-testtools?expand=0&rev=61
This commit is contained in:
committed by
Git OBS Bridge
parent
8f9e912be4
commit
61e5d6feb8
@@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Sep 11 14:52:44 CEST 2018 - mcepl@suse.com
|
||||||
|
|
||||||
|
- Remove requirements of unittest2 and linecache2 adding two
|
||||||
|
additional patches remove-linecache2.patch and
|
||||||
|
remove-unittest2.patch.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sat Aug 11 08:04:56 UTC 2018 - tchvatal@suse.com
|
Sat Aug 11 08:04:56 UTC 2018 - tchvatal@suse.com
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
# license that conforms to the Open Source Definition (Version 1.9)
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
# published by the Open Source Initiative.
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
@@ -26,13 +26,17 @@ Group: Documentation/HTML
|
|||||||
URL: https://launchpad.net/testtools
|
URL: https://launchpad.net/testtools
|
||||||
Source: https://files.pythonhosted.org/packages/source/t/testtools/testtools-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/t/testtools/testtools-%{version}.tar.gz
|
||||||
Patch0: testtools-py37.patch
|
Patch0: testtools-py37.patch
|
||||||
|
Patch1: remove-unittest2.patch
|
||||||
|
Patch2: remove-linecache2.patch
|
||||||
BuildRequires: %{python_module testscenarios}
|
BuildRequires: %{python_module testscenarios}
|
||||||
BuildRequires: %{python_module testtools = %{version}}
|
BuildRequires: %{python_module testtools = %{version}}
|
||||||
|
BuildRequires: %{python_module traceback2}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
BuildRequires: python3-Sphinx
|
BuildRequires: python3-Sphinx
|
||||||
Provides: python2-testtools-doc = %{version}
|
Provides: python2-testtools-doc = %{version}
|
||||||
Provides: python3-testtools-doc = %{version}
|
Provides: python3-testtools-doc = %{version}
|
||||||
|
Requires: python-traceback2
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@@ -40,7 +44,7 @@ Documentation and help files for python-testtools.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n testtools-%{version}
|
%setup -q -n testtools-%{version}
|
||||||
%patch0 -p1
|
%autopatch -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
python3 setup.py build_sphinx && rm build/sphinx/html/.buildinfo
|
python3 setup.py build_sphinx && rm build/sphinx/html/.buildinfo
|
||||||
|
@@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Sep 11 14:52:44 CEST 2018 - mcepl@suse.com
|
||||||
|
|
||||||
|
- Remove requirements of unittest2 and linecache2 adding two
|
||||||
|
additional patches remove-linecache2.patch and
|
||||||
|
remove-unittest2.patch.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Aug 10 11:27:08 UTC 2018 - tchvatal@suse.com
|
Fri Aug 10 11:27:08 UTC 2018 - tchvatal@suse.com
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
# license that conforms to the Open Source Definition (Version 1.9)
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
# published by the Open Source Initiative.
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@ Group: Development/Languages/Python
|
|||||||
URL: https://github.com/testing-cabal/testtools
|
URL: https://github.com/testing-cabal/testtools
|
||||||
Source: https://files.pythonhosted.org/packages/source/t/testtools/testtools-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/t/testtools/testtools-%{version}.tar.gz
|
||||||
Patch0: testtools-py37.patch
|
Patch0: testtools-py37.patch
|
||||||
|
Patch1: remove-unittest2.patch
|
||||||
|
Patch2: remove-linecache2.patch
|
||||||
BuildRequires: %{python_module extras >= 1.0.0}
|
BuildRequires: %{python_module extras >= 1.0.0}
|
||||||
BuildRequires: %{python_module pbr}
|
BuildRequires: %{python_module pbr}
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
|
BuildRequires: %{python_module traceback2}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
Requires: python-extras >= 1.0.0
|
Requires: python-extras >= 1.0.0
|
||||||
@@ -36,7 +39,6 @@ Requires: python-pbr >= 0.11
|
|||||||
Requires: python-python-mimeparse
|
Requires: python-python-mimeparse
|
||||||
Requires: python-six >= 1.4.0
|
Requires: python-six >= 1.4.0
|
||||||
Requires: python-traceback2
|
Requires: python-traceback2
|
||||||
Requires: python-unittest2 >= 1.1.0
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%if 0%{?suse_version} >= 1000 || 0%{?fedora_version} >= 24
|
%if 0%{?suse_version} >= 1000 || 0%{?fedora_version} >= 24
|
||||||
Recommends: python-fixtures >= 1.3.0
|
Recommends: python-fixtures >= 1.3.0
|
||||||
@@ -51,15 +53,18 @@ also ports recent unittest changes all the way back to Python 2.4.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n testtools-%{version}
|
%setup -q -n testtools-%{version}
|
||||||
%patch0 -p1
|
%autopatch -p1
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%python_build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%python_install
|
%python_install
|
||||||
%python_expand %fdupes -s %{buildroot}%{$python_sitelib}
|
%{python_expand \
|
||||||
|
$python -m compileall -d %{$python_sitelib} -x _compat2x %{buildroot}%{$python_sitelib}/testtools/
|
||||||
|
$python -O -m compileall -d %{$python_sitelib} -x _compat2x %{buildroot}%{$python_sitelib}/testtools/
|
||||||
|
%fdupes -s %{buildroot}%{$python_sitelib}
|
||||||
|
}
|
||||||
|
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
|
25
remove-linecache2.patch
Normal file
25
remove-linecache2.patch
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
--- a/testtools/tests/test_compat.py
|
||||||
|
+++ b/testtools/tests/test_compat.py
|
||||||
|
@@ -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
|
||||||
|
--- a/testtools/compat.py
|
||||||
|
+++ b/testtools/compat.py
|
||||||
|
@@ -31,7 +31,7 @@ from extras import try_import, try_impor
|
||||||
|
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'])
|
||||||
|
|
||||||
|
try:
|
||||||
|
from testtools import _compat2x as _compat
|
107
remove-unittest2.patch
Normal file
107
remove-unittest2.patch
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
--- a/testtools/tests/test_run.py
|
||||||
|
+++ b/testtools/tests/test_run.py
|
||||||
|
@@ -10,7 +10,7 @@ from textwrap import dedent
|
||||||
|
from extras import try_import
|
||||||
|
fixtures = try_import('fixtures')
|
||||||
|
testresources = try_import('testresources')
|
||||||
|
-import unittest2
|
||||||
|
+import unittest
|
||||||
|
|
||||||
|
import testtools
|
||||||
|
from testtools import TestCase, run, skipUnless
|
||||||
|
@@ -195,13 +195,13 @@ testtools.runexample.TestFoo.test_quux
|
||||||
|
broken = self.useFixture(SampleTestFixture(broken=True))
|
||||||
|
out = StringIO()
|
||||||
|
# XXX: http://bugs.python.org/issue22811
|
||||||
|
- unittest2.defaultTestLoader._top_level_dir = None
|
||||||
|
+ unittest.defaultTestLoader._top_level_dir = None
|
||||||
|
exc = self.assertRaises(
|
||||||
|
SystemExit,
|
||||||
|
run.main, ['prog', 'discover', '-l', broken.package.base, '*.py'], out)
|
||||||
|
self.assertEqual(2, exc.args[0])
|
||||||
|
self.assertThat(out.getvalue(), DocTestMatches("""\
|
||||||
|
-unittest2.loader._FailedTest.runexample
|
||||||
|
+unittest.loader._FailedTest.runexample
|
||||||
|
Failed to import test module: runexample
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File ".../loader.py", line ..., in _find_test_path
|
||||||
|
@@ -345,7 +345,7 @@ OK
|
||||||
|
pkg = self.useFixture(SampleLoadTestsPackage())
|
||||||
|
out = StringIO()
|
||||||
|
# XXX: http://bugs.python.org/issue22811
|
||||||
|
- unittest2.defaultTestLoader._top_level_dir = None
|
||||||
|
+ unittest.defaultTestLoader._top_level_dir = None
|
||||||
|
self.assertEqual(None, run.main(
|
||||||
|
['prog', 'discover', '-l', pkg.package.base], out))
|
||||||
|
self.assertEqual(dedent("""\
|
||||||
|
--- a/testtools/tests/test_testsuite.py
|
||||||
|
+++ b/testtools/tests/test_testsuite.py
|
||||||
|
@@ -5,7 +5,6 @@
|
||||||
|
import doctest
|
||||||
|
from pprint import pformat
|
||||||
|
import unittest
|
||||||
|
-import unittest2
|
||||||
|
|
||||||
|
from extras import try_import
|
||||||
|
|
||||||
|
@@ -225,7 +224,7 @@ TypeError: run() takes ...1 ...argument.
|
||||||
|
pass
|
||||||
|
# Test discovery uses the default suite from unittest2 (unless users
|
||||||
|
# deliberately change things, in which case they keep both pieces).
|
||||||
|
- suite = unittest2.TestSuite([Skips("test_notrun")])
|
||||||
|
+ suite = unittest.TestSuite([Skips("test_notrun")])
|
||||||
|
log = []
|
||||||
|
result = LoggingResult(log)
|
||||||
|
suite.run(result)
|
||||||
|
@@ -242,7 +241,7 @@ TypeError: run() takes ...1 ...argument.
|
||||||
|
pass
|
||||||
|
# Test discovery uses the default suite from unittest2 (unless users
|
||||||
|
# deliberately change things, in which case they keep both pieces).
|
||||||
|
- suite = unittest2.TestSuite([Simples("test_simple")])
|
||||||
|
+ suite = unittest.TestSuite([Simples("test_simple")])
|
||||||
|
log = []
|
||||||
|
result = LoggingResult(log)
|
||||||
|
suite.run(result)
|
||||||
|
--- a/testtools/tests/twistedsupport/test_deferred.py
|
||||||
|
+++ b/testtools/tests/twistedsupport/test_deferred.py
|
||||||
|
@@ -52,5 +52,5 @@ class TestExtractResult(NeedsTwistedTest
|
||||||
|
|
||||||
|
|
||||||
|
def test_suite():
|
||||||
|
- from unittest2 import TestLoader, TestSuite
|
||||||
|
+ from unittest import TestLoader, TestSuite
|
||||||
|
return TestLoader().loadTestsFromName(__name__)
|
||||||
|
--- a/testtools/tests/twistedsupport/test_matchers.py
|
||||||
|
+++ b/testtools/tests/twistedsupport/test_matchers.py
|
||||||
|
@@ -205,5 +205,5 @@ class FailureResultTests(NeedsTwistedTes
|
||||||
|
|
||||||
|
|
||||||
|
def test_suite():
|
||||||
|
- from unittest2 import TestLoader, TestSuite
|
||||||
|
+ from unittest import TestLoader, TestSuite
|
||||||
|
return TestLoader().loadTestsFromName(__name__)
|
||||||
|
--- a/testtools/tests/twistedsupport/test_runtest.py
|
||||||
|
+++ b/testtools/tests/twistedsupport/test_runtest.py
|
||||||
|
@@ -1016,7 +1016,7 @@ class TestCaptureTwistedLogs(NeedsTwiste
|
||||||
|
|
||||||
|
|
||||||
|
def test_suite():
|
||||||
|
- from unittest2 import TestLoader, TestSuite
|
||||||
|
+ from unittest import TestLoader, TestSuite
|
||||||
|
return TestLoader().loadTestsFromName(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
--- a/testtools/run.py
|
||||||
|
+++ b/testtools/run.py
|
||||||
|
@@ -195,7 +195,10 @@ class TestProgram(unittest.TestProgram):
|
||||||
|
else:
|
||||||
|
for test in iterate_tests(self.test):
|
||||||
|
self.stdout.write('%s\n' % test.id())
|
||||||
|
- del self.testLoader.errors[:]
|
||||||
|
+ if hasattr(self.testLoader, 'errors'):
|
||||||
|
+ del self.testLoader.errors[:]
|
||||||
|
+ else:
|
||||||
|
+ self.testLoader.errors = []
|
||||||
|
|
||||||
|
def _getParentArgParser(self):
|
||||||
|
parser = super(TestProgram, self)._getParentArgParser()
|
Reference in New Issue
Block a user