diff options
| author | R. David Murray <rdmurray@bitdance.com> | 2010-02-23 00:24:49 (GMT) |
|---|---|---|
| committer | R. David Murray <rdmurray@bitdance.com> | 2010-02-23 00:24:49 (GMT) |
| commit | f28fd24c36310541a1f3ec74e92e8d38629dd5d8 (patch) | |
| tree | ca85998492ba91f8874ba63fecd77397f65ad3d6 /Lib/test/test_contextlib.py | |
| parent | 87bcb243acfd758b3e91e194bf8f1198ae68a792 (diff) | |
| download | cpython-f28fd24c36310541a1f3ec74e92e8d38629dd5d8.zip cpython-f28fd24c36310541a1f3ec74e92e8d38629dd5d8.tar.gz cpython-f28fd24c36310541a1f3ec74e92e8d38629dd5d8.tar.bz2 | |
Issue 6292: for the moment at least, the test suite passes if run
with -OO. Tests requiring docstrings are skipped. Patch by
Brian Curtin, thanks to Matias Torchinsky for helping review and
improve the patch.
Diffstat (limited to 'Lib/test/test_contextlib.py')
| -rw-r--r-- | Lib/test/test_contextlib.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py index 6350717..4d233da 100644 --- a/Lib/test/test_contextlib.py +++ b/Lib/test/test_contextlib.py @@ -2,6 +2,7 @@ import os +import sys import tempfile import unittest import threading @@ -84,7 +85,7 @@ class ContextManagerTestCase(unittest.TestCase): raise ZeroDivisionError(999) self.assertEqual(state, [1, 42, 999]) - def test_contextmanager_attribs(self): + def _create_contextmanager_attribs(self): def attribs(**kw): def decorate(func): for k,v in kw.items(): @@ -95,8 +96,17 @@ class ContextManagerTestCase(unittest.TestCase): @attribs(foo='bar') def baz(spam): """Whee!""" + return baz + + def test_contextmanager_attribs(self): + baz = self._create_contextmanager_attribs() self.assertEqual(baz.__name__,'baz') self.assertEqual(baz.foo, 'bar') + + @unittest.skipIf(sys.flags.optimize >= 2, + "Docstrings are omitted with -O2 and above") + def test_contextmanager_doc_attrib(self): + baz = self._create_contextmanager_attribs() self.assertEqual(baz.__doc__, "Whee!") class NestedTestCase(unittest.TestCase): |
