diff --git a/test/test_utils.py b/test/test_utils.py index 84b966ed..33353de1 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -51,14 +51,15 @@ class TestSetupReadline(unittest.TestCase): self.namespace.sys = sys self.namespace.os = os - assert self.completions('os.path.join') == ['os.path.join'] - assert self.completions('os.path.join().upper') == ['os.path.join().upper'] + try: + assert self.completions('os.path.join') == ['os.path.join'] + assert self.completions('os.path.join().upper') == ['os.path.join().upper'] - c = set(['os.' + d for d in dir(os) if d.startswith('ch')]) - assert set(self.completions('os.ch')) == set(c) - - del self.namespace.sys - del self.namespace.os + c = set(['os.' + d for d in dir(os) if d.startswith('ch')]) + assert set(self.completions('os.ch')) == set(c) + finally: + del self.namespace.sys + del self.namespace.os def test_calls(self): s = 'str(bytes'