diff --git a/src/zodbpickle/tests/pickletester_2.py b/src/zodbpickle/tests/pickletester_2.py index 74d54d2..fc3ac6f 100644 --- a/src/zodbpickle/tests/pickletester_2.py +++ b/src/zodbpickle/tests/pickletester_2.py @@ -1178,16 +1178,17 @@ def test_incomplete_input(self): s = StringIO.StringIO("X''.") self.assertRaises(EOFError, self.module.load, s) - @unittest.skipIf(_is_pypy, - "Fails to access the redefined builtins") - def test_restricted(self): - # issue7128: cPickle failed in restricted mode - builtins = {'pickleme': self.module, - '__import__': __import__} - d = {} - teststr = "def f(): pickleme.dumps(0)" - exec teststr in {'__builtins__': builtins}, d - d['f']() + if not _is_pypy: + # PyPy cannot redefine the builtins; + # don't use unittest.skipIf because that's not in 2.6 + def test_restricted(self): + # issue7128: cPickle failed in restricted mode + builtins = {'pickleme': self.module, + '__import__': __import__} + d = {} + teststr = "def f(): pickleme.dumps(0)" + exec teststr in {'__builtins__': builtins}, d + d['f']() def test_bad_input(self): # Test issue4298