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

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