Commit e595b5de authored by Tim Peters's avatar Tim Peters

Rev 45706 renamed stuff in contextlib.py, but didn't rename

uses of it in test_with.py.  As a result, test_with has been skipped
(due to failing imports) on all buildbot boxes since.  Alas, that's
not a test failure -- you have to pay attention to the

    1 skip unexpected on PLATFORM:
        test_with

kinds of output at the ends of test runs to notice that this got
broken.

It's likely that more renaming in test_with.py would be desirable.
parent 66d7db84
...@@ -10,13 +10,13 @@ __email__ = "mbland at acm dot org" ...@@ -10,13 +10,13 @@ __email__ = "mbland at acm dot org"
import sys import sys
import unittest import unittest
from collections import deque from collections import deque
from contextlib import GeneratorContextManager, contextmanager from contextlib import GeneratorContext, contextfactory
from test.test_support import run_unittest from test.test_support import run_unittest
class MockContextManager(GeneratorContextManager): class MockContextManager(GeneratorContext):
def __init__(self, gen): def __init__(self, gen):
GeneratorContextManager.__init__(self, gen) GeneratorContext.__init__(self, gen)
self.context_called = False self.context_called = False
self.enter_called = False self.enter_called = False
self.exit_called = False self.exit_called = False
...@@ -24,16 +24,16 @@ class MockContextManager(GeneratorContextManager): ...@@ -24,16 +24,16 @@ class MockContextManager(GeneratorContextManager):
def __context__(self): def __context__(self):
self.context_called = True self.context_called = True
return GeneratorContextManager.__context__(self) return GeneratorContext.__context__(self)
def __enter__(self): def __enter__(self):
self.enter_called = True self.enter_called = True
return GeneratorContextManager.__enter__(self) return GeneratorContext.__enter__(self)
def __exit__(self, type, value, traceback): def __exit__(self, type, value, traceback):
self.exit_called = True self.exit_called = True
self.exit_args = (type, value, traceback) self.exit_args = (type, value, traceback)
return GeneratorContextManager.__exit__(self, type, value, traceback) return GeneratorContext.__exit__(self, type, value, traceback)
def mock_contextmanager(func): def mock_contextmanager(func):
...@@ -495,7 +495,7 @@ class ExceptionalTestCase(unittest.TestCase, ContextmanagerAssertionMixin): ...@@ -495,7 +495,7 @@ class ExceptionalTestCase(unittest.TestCase, ContextmanagerAssertionMixin):
self.assertAfterWithGeneratorInvariantsNoError(self.bar) self.assertAfterWithGeneratorInvariantsNoError(self.bar)
def testRaisedStopIteration1(self): def testRaisedStopIteration1(self):
@contextmanager @contextfactory
def cm(): def cm():
yield yield
...@@ -523,7 +523,7 @@ class ExceptionalTestCase(unittest.TestCase, ContextmanagerAssertionMixin): ...@@ -523,7 +523,7 @@ class ExceptionalTestCase(unittest.TestCase, ContextmanagerAssertionMixin):
self.assertRaises(StopIteration, shouldThrow) self.assertRaises(StopIteration, shouldThrow)
def testRaisedGeneratorExit1(self): def testRaisedGeneratorExit1(self):
@contextmanager @contextfactory
def cm(): def cm():
yield yield
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment