[pypy-commit] pypy cleanup-test_lib_pypy: Move test_cPickle
rlamy
pypy.commits at gmail.com
Tue Dec 4 23:18:24 EST 2018
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: cleanup-test_lib_pypy
Changeset: r95415:55ef81f0789c
Date: 2018-12-05 04:17 +0000
http://bitbucket.org/pypy/pypy/changeset/55ef81f0789c/
Log: Move test_cPickle
diff --git a/pypy/module/test_lib_pypy/test_cPickle.py b/extra_tests/test_cPickle.py
rename from pypy/module/test_lib_pypy/test_cPickle.py
rename to extra_tests/test_cPickle.py
--- a/pypy/module/test_lib_pypy/test_cPickle.py
+++ b/extra_tests/test_cPickle.py
@@ -1,14 +1,14 @@
-from __future__ import absolute_import
-import py
-
-from lib_pypy import cPickle
+import pytest
+import cPickle
def test_stack_underflow():
- py.test.raises(cPickle.UnpicklingError, cPickle.loads, "a string")
+ with pytest.raises(cPickle.UnpicklingError):
+ cPickle.loads("a string")
def test_bad_key():
- e = py.test.raises(cPickle.UnpicklingError, cPickle.loads, "v")
- assert str(e.value) == "invalid load key, 'v'."
+ with pytest.raises(cPickle.UnpicklingError) as excinfo:
+ cPickle.loads("v")
+ assert str(excinfo.value) == "invalid load key, 'v'."
def test_find_global():
import time, cStringIO
@@ -23,7 +23,8 @@
f = cStringIO.StringIO(f.getvalue())
up = cPickle.Unpickler(f)
up.find_global = None
- e = py.test.raises(cPickle.UnpicklingError, up.load)
+ with pytest.raises(cPickle.UnpicklingError) as e:
+ up.load()
assert str(e.value) == "Global and instance pickles are not supported."
f = cStringIO.StringIO(f.getvalue())
More information about the pypy-commit
mailing list