14
0

Accepting request 649240 from devel:languages:python

Revert for now, breaks packages depending on this

OBS-URL: https://build.opensuse.org/request/show/649240
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-testtools?expand=0&rev=62
This commit is contained in:
Tomáš Chvátal
2018-11-15 11:40:30 +00:00
committed by Git OBS Bridge
parent 61e5d6feb8
commit 86de05fb9d
6 changed files with 7 additions and 162 deletions

View File

@@ -1,10 +1,3 @@
-------------------------------------------------------------------
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

View File

@@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
@@ -26,17 +26,13 @@ Group: Documentation/HTML
URL: https://launchpad.net/testtools
Source: https://files.pythonhosted.org/packages/source/t/testtools/testtools-%{version}.tar.gz
Patch0: testtools-py37.patch
Patch1: remove-unittest2.patch
Patch2: remove-linecache2.patch
BuildRequires: %{python_module testscenarios}
BuildRequires: %{python_module testtools = %{version}}
BuildRequires: %{python_module traceback2}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: python3-Sphinx
Provides: python2-testtools-doc = %{version}
Provides: python3-testtools-doc = %{version}
Requires: python-traceback2
BuildArch: noarch
%description
@@ -44,7 +40,7 @@ Documentation and help files for python-testtools.
%prep
%setup -q -n testtools-%{version}
%autopatch -p1
%patch0 -p1
%build
python3 setup.py build_sphinx && rm build/sphinx/html/.buildinfo

View File

@@ -1,10 +1,3 @@
-------------------------------------------------------------------
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

View File

@@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
@@ -26,12 +26,9 @@ Group: Development/Languages/Python
URL: https://github.com/testing-cabal/testtools
Source: https://files.pythonhosted.org/packages/source/t/testtools/testtools-%{version}.tar.gz
Patch0: testtools-py37.patch
Patch1: remove-unittest2.patch
Patch2: remove-linecache2.patch
BuildRequires: %{python_module extras >= 1.0.0}
BuildRequires: %{python_module pbr}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module traceback2}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-extras >= 1.0.0
@@ -39,6 +36,7 @@ Requires: python-pbr >= 0.11
Requires: python-python-mimeparse
Requires: python-six >= 1.4.0
Requires: python-traceback2
Requires: python-unittest2 >= 1.1.0
BuildArch: noarch
%if 0%{?suse_version} >= 1000 || 0%{?fedora_version} >= 24
Recommends: python-fixtures >= 1.3.0
@@ -53,18 +51,15 @@ also ports recent unittest changes all the way back to Python 2.4.
%prep
%setup -q -n testtools-%{version}
%autopatch -p1
%patch0 -p1
%build
%python_build
%install
%python_install
%{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}
}
%python_expand %fdupes -s %{buildroot}%{$python_sitelib}
%files %{python_files}
%license LICENSE

View File

@@ -1,25 +0,0 @@
--- 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

View File

@@ -1,107 +0,0 @@
--- 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()