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

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