1 diff -up Python-2.7.2/Lib/unittest/case.py.add-rpmbuild-hooks-to-unittest Python-2.7.2/Lib/unittest/case.py
2 --- Python-2.7.2/Lib/unittest/case.py.add-rpmbuild-hooks-to-unittest 2011-09-08 14:45:47.677169191 -0400
3 +++ Python-2.7.2/Lib/unittest/case.py 2011-09-08 16:01:36.287858159 -0400
5 """Test case implementation"""
12 @@ -94,6 +95,43 @@ def expectedFailure(func):
16 +# Non-standard/downstream-only hooks for handling issues with specific test
19 +def _skipInRpmBuild(reason):
21 + Non-standard/downstream-only decorator for marking a specific unit test
22 + to be skipped when run within the %check of an rpmbuild.
24 + Specifically, this takes effect when WITHIN_PYTHON_RPM_BUILD is set within
25 + the environment, and has no effect otherwise.
27 + if 'WITHIN_PYTHON_RPM_BUILD' in os.environ:
32 +def _expectedFailureInRpmBuild(func):
34 + Non-standard/downstream-only decorator for marking a specific unit test
35 + as expected to fail within the %check of an rpmbuild.
37 + Specifically, this takes effect when WITHIN_PYTHON_RPM_BUILD is set within
38 + the environment, and has no effect otherwise.
40 + @functools.wraps(func)
41 + def wrapper(*args, **kwargs):
42 + if 'WITHIN_PYTHON_RPM_BUILD' in os.environ:
44 + func(*args, **kwargs)
46 + raise _ExpectedFailure(sys.exc_info())
47 + raise _UnexpectedSuccess
50 + func(*args, **kwargs)
53 class _AssertRaisesContext(object):
54 """A context manager used to implement TestCase.assertRaises* methods."""
56 diff -up Python-2.7.2/Lib/unittest/__init__.py.add-rpmbuild-hooks-to-unittest Python-2.7.2/Lib/unittest/__init__.py
57 --- Python-2.7.2/Lib/unittest/__init__.py.add-rpmbuild-hooks-to-unittest 2011-09-08 14:59:39.534112310 -0400
58 +++ Python-2.7.2/Lib/unittest/__init__.py 2011-09-08 15:07:09.191081562 -0400
59 @@ -57,7 +57,8 @@ __unittest = True
61 from .result import TestResult
62 from .case import (TestCase, FunctionTestCase, SkipTest, skip, skipIf,
63 - skipUnless, expectedFailure)
64 + skipUnless, expectedFailure,
65 + _skipInRpmBuild, _expectedFailureInRpmBuild)
66 from .suite import BaseTestSuite, TestSuite
67 from .loader import (TestLoader, defaultTestLoader, makeSuite, getTestCaseNames,