Blame SOURCES/00132-add-rpmbuild-hooks-to-unittest.patch

900f19
diff -up Python-3.2.2/Lib/unittest/case.py.add-rpmbuild-hooks-to-unittest Python-3.2.2/Lib/unittest/case.py
900f19
--- Python-3.2.2/Lib/unittest/case.py.add-rpmbuild-hooks-to-unittest	2011-09-03 12:16:44.000000000 -0400
900f19
+++ Python-3.2.2/Lib/unittest/case.py	2011-09-09 06:35:16.365568382 -0400
900f19
@@ -3,6 +3,7 @@
900f19
 import sys
900f19
 import functools
900f19
 import difflib
900f19
+import os
900f19
 import logging
900f19
 import pprint
900f19
 import re
900f19
@@ -101,5 +102,21 @@ def expectedFailure(func):
900f19
         raise self.test_case.failureException(msg)
900f19
 
900f19
+# Non-standard/downstream-only hooks for handling issues with specific test
900f19
+# cases:
900f19
+
900f19
+def _skipInRpmBuild(reason):
900f19
+    """
900f19
+    Non-standard/downstream-only decorator for marking a specific unit test
900f19
+    to be skipped when run within the %check of an rpmbuild.
900f19
+
900f19
+    Specifically, this takes effect when WITHIN_PYTHON_RPM_BUILD is set within
900f19
+    the environment, and has no effect otherwise.
900f19
+    """
900f19
+    if 'WITHIN_PYTHON_RPM_BUILD' in os.environ:
900f19
+        return skip(reason)
900f19
+    else:
900f19
+        return _id
900f19
+
900f19
 class _AssertRaisesBaseContext(_BaseTestCaseContext):
900f19
 
900f19
     def __init__(self, expected, test_case, expected_regex=None):
900f19
diff -up Python-3.2.2/Lib/unittest/__init__.py.add-rpmbuild-hooks-to-unittest Python-3.2.2/Lib/unittest/__init__.py
900f19
--- Python-3.2.2/Lib/unittest/__init__.py.add-rpmbuild-hooks-to-unittest	2011-09-03 12:16:44.000000000 -0400
900f19
+++ Python-3.2.2/Lib/unittest/__init__.py	2011-09-09 06:35:16.366568382 -0400
900f19
@@ -57,7 +57,8 @@ __unittest = True
900f19
 
900f19
 from .result import TestResult
900f19
 from .case import (TestCase, FunctionTestCase, SkipTest, skip, skipIf,
900f19
-                   skipUnless, expectedFailure)
900f19
+                   skipUnless, expectedFailure,
900f19
+                   _skipInRpmBuild)
900f19
 from .suite import BaseTestSuite, TestSuite
900f19
 from .loader import (TestLoader, defaultTestLoader, makeSuite, getTestCaseNames,
900f19
                      findTestCases)