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

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