#6 Patch to remove unittest2 and traceback2 from source
Merged 2 days ago by churchyard. Opened a month ago by aviso.
rpms/ aviso/python-testtools master  into  master

file modified
+8 -3

@@ -1,9 +1,9 @@ 

- %bcond_without tests

+ %bcond_with tests

  %bcond_without docs

  

  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 @@ 

  

  # 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 @@ 

  

  # 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 @@ 

  %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 @@ 

  

  

  %changelog

+ * Thu Feb 20 2020 Avram Lubkin <aviso@rockhopper.net> - 2.3.0-18

+ - Patch to remove unittest2 and traceback2 from source

+ 

  * Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.0-17

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

  

file added
+288

@@ -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)

Patch to remove unittest2, traceback2, and linecache2 backports from source to allow for retirement of related packages.

If you rebase this, I can merge it as a provenpackager.

I'll do it as soon as I get a chance. New job, so not a lot of free cycles at the moment.

rebased onto a9f35e7

6 days ago

Rebased. Hopefully the Ci will kick in.

Is this a chicken-egg environment-specific issue in the simple-koji-ci build?

DEBUG util.py:596:  Error: 
DEBUG util.py:596:   Problem: package python3-testscenarios-0.5.0-18.fc32.noarch requires python3-testtools, but none of the providers can be installed
DEBUG util.py:596:    - package python3-testscenarios-0.5.0-18.fc32.noarch requires python3.8dist(testtools), but none of the providers can be installed
DEBUG util.py:596:    - conflicting requests
DEBUG util.py:596:    - nothing provides python3.8dist(traceback2) needed by python3-testtools-2.3.0-17.fc32.noarc

Not specific. Needs to be built without tests first, then with.

1 new commit added

  • Rebuild without tests to bootstrap the selfdependency loop
2 days ago

Pull-Request has been merged by churchyard

2 days ago