From a9f35e790da9df7278d56e497ece180d8366118a Mon Sep 17 00:00:00 2001 From: Avram Lubkin Date: Feb 20 2020 07:28:48 +0000 Subject: [PATCH 1/2] Patch to remove unittest2 and traceback2 from source --- diff --git a/python-testtools.spec b/python-testtools.spec index dc3bc9b..29d285b 100644 --- a/python-testtools.spec +++ b/python-testtools.spec @@ -3,7 +3,7 @@ Name: python-testtools Version: 2.3.0 -Release: 17%{?dist} +Release: 18%{?dist} Summary: Extensions to the Python unit testing framework License: MIT @@ -13,6 +13,7 @@ Patch0: testtools-1.8.0-py3.patch # https://github.com/testing-cabal/testtools/pull/271 Patch1: testtools-2.3.0-py37.patch +Patch2: remove_backports.patch BuildArch: noarch @@ -67,6 +68,7 @@ This package contains HTML documentation for %{name}. # make the Python 3 build load the Python 3.x compatibility library directly %patch0 -p1 -b .py3 +%patch2 -p1 find . -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' rm testtools/_compat2x.py @@ -87,7 +89,7 @@ PYTHONPATH=$PWD make -C doc html %if %{with tests} %check make PYTHON=%{__python3} check -%endif # if with tests +%endif %files -n python3-testtools %doc NEWS README.rst @@ -101,6 +103,9 @@ make PYTHON=%{__python3} check %changelog +* Thu Feb 20 2020 Avram Lubkin - 2.3.0-18 +- Patch to remove unittest2 and traceback2 from source + * Thu Jan 30 2020 Fedora Release Engineering - 2.3.0-17 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild diff --git a/remove_backports.patch b/remove_backports.patch new file mode 100644 index 0000000..45885b8 --- /dev/null +++ b/remove_backports.patch @@ -0,0 +1,288 @@ +diff -ru testtools-2.3.0-orig/requirements.txt testtools-2.3.0/requirements.txt +--- testtools-2.3.0-orig/requirements.txt 2016-10-22 13:21:40.000000000 -0400 ++++ testtools-2.3.0/requirements.txt 2020-01-22 19:26:30.863707850 -0500 +@@ -4,6 +4,4 @@ + # '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 + six>=1.4.0 +diff -ru testtools-2.3.0-orig/setup.cfg testtools-2.3.0/setup.cfg +--- testtools-2.3.0-orig/setup.cfg 2017-05-11 09:48:50.000000000 -0400 ++++ testtools-2.3.0/setup.cfg 2020-01-22 19:22:54.808892653 -0500 +@@ -5,15 +5,14 @@ + description-file = doc/overview.rst + author = Jonathan M. Lange + author-email = jml+testtools@mumak.net +-classifier = ++classifier = + License :: OSI Approved :: MIT License + Programming Language :: Python :: 3 + + [extras] +-test = ++test = + testscenarios + testresources +- unittest2>=1.1.0 + + [files] + packages = testtools +@@ -24,5 +23,4 @@ + [egg_info] + tag_date = 0 + tag_svn_revision = 0 +-tag_build = +- ++tag_build = +diff -ru testtools-2.3.0-orig/testtools/compat.py testtools-2.3.0/testtools/compat.py +--- testtools-2.3.0-orig/testtools/compat.py 2016-10-22 13:21:40.000000000 -0400 ++++ testtools-2.3.0/testtools/compat.py 2020-01-22 19:38:36.628892814 -0500 +@@ -223,5 +223,3 @@ + # no benefit in asking more than once as it's a global + # setting that can change after the message is formatted. + return locale.getlocale(locale.LC_MESSAGES)[1] or "ascii" +- +- +diff -ru testtools-2.3.0-orig/testtools/content.py testtools-2.3.0/testtools/content.py +--- testtools-2.3.0-orig/testtools/content.py 2016-11-07 12:24:31.000000000 -0500 ++++ testtools-2.3.0/testtools/content.py 2020-01-22 19:26:25.914712083 -0500 +@@ -17,10 +17,9 @@ + import json + import os + import sys ++import traceback + + from extras import try_import +-# To let setup.py work, make this a conditional import. +-traceback = try_import('traceback2') + + from testtools.compat import ( + _b, +diff -ru testtools-2.3.0-orig/testtools/run.py testtools-2.3.0/testtools/run.py +--- testtools-2.3.0-orig/testtools/run.py 2017-04-11 10:30:44.000000000 -0400 ++++ testtools-2.3.0/testtools/run.py 2020-01-22 19:57:16.088133809 -0500 +@@ -12,10 +12,10 @@ + from functools import partial + import os.path + import sys ++import unittest + + from extras import safe_hasattr, try_imports + # To let setup.py work, make this a conditional import. +-unittest = try_imports(['unittest2', 'unittest']) + + from testtools import TextTestResult, testcase + from testtools.compat import classtypes, istext, unicode_output_stream +@@ -50,7 +50,6 @@ + describing things that failed to import. + """ + unittest_import_strs = set([ +- 'unittest2.loader.ModuleImportFailure.', + 'unittest.loader.ModuleImportFailure.', + 'discover.ModuleImportFailure.' + ]) +diff -ru testtools-2.3.0-orig/testtools/testcase.py testtools-2.3.0/testtools/testcase.py +--- testtools-2.3.0-orig/testtools/testcase.py 2017-01-30 13:43:16.000000000 -0500 ++++ testtools-2.3.0/testtools/testcase.py 2020-01-22 20:11:05.944826324 -0500 +@@ -20,6 +20,7 @@ + import functools + import itertools + import sys ++import unittest + import warnings + + from extras import ( +@@ -28,7 +29,6 @@ + try_imports, + ) + # To let setup.py work, make this a conditional import. +-unittest = try_imports(['unittest2', 'unittest']) + import six + + from testtools import ( +@@ -62,23 +62,8 @@ + + wraps = try_import('functools.wraps') + +- +-class TestSkipped(Exception): +- """Raised within TestCase.run() when a test is skipped.""" +-TestSkipped = try_import('unittest.case.SkipTest', TestSkipped) +-TestSkipped = try_import('unittest2.case.SkipTest', TestSkipped) +- +- +-class _UnexpectedSuccess(Exception): +- """An unexpected success was raised. +- +- Note that this exception is private plumbing in testtools' testcase +- module. +- """ +-_UnexpectedSuccess = try_import( +- 'unittest.case._UnexpectedSuccess', _UnexpectedSuccess) +-_UnexpectedSuccess = try_import( +- 'unittest2.case._UnexpectedSuccess', _UnexpectedSuccess) ++from unittest.case import SkipTest as TestSkipped ++from unittest.case import _UnexpectedSuccess + + + class _ExpectedFailure(Exception): +@@ -87,10 +72,6 @@ + Note that this exception is private plumbing in testtools' testcase + module. + """ +-_ExpectedFailure = try_import( +- 'unittest.case._ExpectedFailure', _ExpectedFailure) +-_ExpectedFailure = try_import( +- 'unittest2.case._ExpectedFailure', _ExpectedFailure) + + + # Copied from unittest before python 3.4 release. Used to maintain +diff -ru testtools-2.3.0-orig/testtools/tests/test_compat.py testtools-2.3.0/testtools/tests/test_compat.py +--- testtools-2.3.0-orig/testtools/tests/test_compat.py 2016-10-22 13:21:40.000000000 -0400 ++++ testtools-2.3.0/testtools/tests/test_compat.py 2020-01-22 19:27:16.335668952 -0500 +@@ -3,7 +3,7 @@ + """Tests for miscellaneous compatibility functions""" + + import io +-import linecache2 as linecache ++import linecache + import os + import sys + import tempfile +diff -ru testtools-2.3.0-orig/testtools/tests/test_run.py testtools-2.3.0/testtools/tests/test_run.py +--- testtools-2.3.0-orig/testtools/tests/test_run.py 2016-10-22 13:21:40.000000000 -0400 ++++ testtools-2.3.0/testtools/tests/test_run.py 2020-01-22 19:23:26.011865968 -0500 +@@ -10,7 +10,7 @@ + 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 @@ + 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 @@ + 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("""\ +diff -ru testtools-2.3.0-orig/testtools/tests/test_testsuite.py testtools-2.3.0/testtools/tests/test_testsuite.py +--- testtools-2.3.0-orig/testtools/tests/test_testsuite.py 2016-11-26 11:20:14.000000000 -0500 ++++ testtools-2.3.0/testtools/tests/test_testsuite.py 2020-01-22 20:00:51.324138620 -0500 +@@ -5,7 +5,7 @@ + import doctest + from pprint import pformat + import unittest +-import unittest2 ++import unittest + + from extras import try_import + +@@ -223,9 +223,9 @@ + raise cls.skipException('foo') + def test_notrun(self): + pass +- # Test discovery uses the default suite from unittest2 (unless users ++ # Test discovery uses the default suite from unittest (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) +@@ -240,9 +240,9 @@ + super(Simples, cls).setUpClass() + def test_simple(self): + pass +- # Test discovery uses the default suite from unittest2 (unless users ++ # Test discovery uses the default suite from unittest (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) +diff -ru testtools-2.3.0-orig/testtools/tests/twistedsupport/test_deferred.py testtools-2.3.0/testtools/tests/twistedsupport/test_deferred.py +--- testtools-2.3.0-orig/testtools/tests/twistedsupport/test_deferred.py 2016-10-22 13:21:40.000000000 -0400 ++++ testtools-2.3.0/testtools/tests/twistedsupport/test_deferred.py 2020-01-22 19:24:51.892792510 -0500 +@@ -52,5 +52,5 @@ + + + def test_suite(): +- from unittest2 import TestLoader, TestSuite ++ from unittest import TestLoader, TestSuite + return TestLoader().loadTestsFromName(__name__) +diff -ru testtools-2.3.0-orig/testtools/tests/twistedsupport/test_matchers.py testtools-2.3.0/testtools/tests/twistedsupport/test_matchers.py +--- testtools-2.3.0-orig/testtools/tests/twistedsupport/test_matchers.py 2016-10-22 13:21:40.000000000 -0400 ++++ testtools-2.3.0/testtools/tests/twistedsupport/test_matchers.py 2020-01-22 19:24:56.353788694 -0500 +@@ -205,5 +205,5 @@ + + + def test_suite(): +- from unittest2 import TestLoader, TestSuite ++ from unittest import TestLoader, TestSuite + return TestLoader().loadTestsFromName(__name__) +diff -ru testtools-2.3.0-orig/testtools/tests/twistedsupport/test_runtest.py testtools-2.3.0/testtools/tests/twistedsupport/test_runtest.py +--- testtools-2.3.0-orig/testtools/tests/twistedsupport/test_runtest.py 2016-10-22 13:21:40.000000000 -0400 ++++ testtools-2.3.0/testtools/tests/twistedsupport/test_runtest.py 2020-01-22 19:25:00.501785145 -0500 +@@ -1016,7 +1016,7 @@ + + + def test_suite(): +- from unittest2 import TestLoader, TestSuite ++ from unittest import TestLoader, TestSuite + return TestLoader().loadTestsFromName(__name__) + + +diff -ru testtools-2.3.0-orig/testtools/testsuite.py testtools-2.3.0/testtools/testsuite.py +--- testtools-2.3.0-orig/testtools/testsuite.py 2016-10-22 13:21:40.000000000 -0400 ++++ testtools-2.3.0/testtools/testsuite.py 2020-01-22 20:00:22.049153497 -0500 +@@ -16,8 +16,6 @@ + import unittest + + from extras import safe_hasattr, try_imports +-# This is just to let setup.py work, as testtools is imported in setup.py. +-unittest2 = try_imports(['unittest2', 'unittest']) + Queue = try_imports(['Queue.Queue', 'queue.Queue']) + + import testtools +@@ -35,7 +33,7 @@ + yield subtest + + +-class ConcurrentTestSuite(unittest2.TestSuite): ++class ConcurrentTestSuite(unittest.TestSuite): + """A TestSuite whose run() calls out to a concurrency strategy.""" + + def __init__(self, suite, make_tests, wrap_result=None): +@@ -198,7 +196,7 @@ + process_result.stopTestRun() + + +-class FixtureSuite(unittest2.TestSuite): ++class FixtureSuite(unittest.TestSuite): + + def __init__(self, fixture, tests): + super(FixtureSuite, self).__init__(tests) From 03e7499c70c7036e886710e04443806e41d04451 Mon Sep 17 00:00:00 2001 From: Miro HronĨok Date: Feb 24 2020 16:10:16 +0000 Subject: [PATCH 2/2] Rebuild without tests to bootstrap the selfdependency loop --- diff --git a/python-testtools.spec b/python-testtools.spec index 29d285b..d748db9 100644 --- a/python-testtools.spec +++ b/python-testtools.spec @@ -1,4 +1,4 @@ -%bcond_without tests +%bcond_with tests %bcond_without docs Name: python-testtools