1 diff -up Python-3.2.2/Lib/unittest/case.py.add-rpmbuild-hooks-to-unittest Python-3.2.2/Lib/unittest/case.py
2 --- Python-3.2.2/Lib/unittest/case.py.add-rpmbuild-hooks-to-unittest 2011-09-03 12:16:44.000000000 -0400
3 +++ Python-3.2.2/Lib/unittest/case.py 2011-09-09 06:35:16.365568382 -0400
12 @@ -101,6 +102,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 _AssertRaisesBaseContext(object):
55 def __init__(self, expected, test_case, callable_obj=None,
56 diff -up Python-3.2.2/Lib/unittest/__init__.py.add-rpmbuild-hooks-to-unittest Python-3.2.2/Lib/unittest/__init__.py
57 --- Python-3.2.2/Lib/unittest/__init__.py.add-rpmbuild-hooks-to-unittest 2011-09-03 12:16:44.000000000 -0400
58 +++ Python-3.2.2/Lib/unittest/__init__.py 2011-09-09 06:35:16.366568382 -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,