diff options
author | Josh Matthews <josh@joshmatthews.net> | 2018-01-04 13:44:24 -0500 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2018-01-09 12:52:27 -0500 |
commit | 2b6f573eb5d1920cec5ad8a1ee98474b715e2e08 (patch) | |
tree | 3d900a9792c86b5a27865914f3e100b28ad9334a /tests/wpt/web-platform-tests/tools/pytest/doc/en/example/multipython.py | |
parent | aa199307c86051e13b17a5feb77722ddcdeed5ce (diff) | |
download | servo-2b6f573eb5d1920cec5ad8a1ee98474b715e2e08.tar.gz servo-2b6f573eb5d1920cec5ad8a1ee98474b715e2e08.zip |
Update web-platform-tests to revision be5419e845d39089ba6dc338c1bd0fa279108317
Diffstat (limited to 'tests/wpt/web-platform-tests/tools/pytest/doc/en/example/multipython.py')
-rw-r--r-- | tests/wpt/web-platform-tests/tools/pytest/doc/en/example/multipython.py | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/tests/wpt/web-platform-tests/tools/pytest/doc/en/example/multipython.py b/tests/wpt/web-platform-tests/tools/pytest/doc/en/example/multipython.py deleted file mode 100644 index 66a368a1267..00000000000 --- a/tests/wpt/web-platform-tests/tools/pytest/doc/en/example/multipython.py +++ /dev/null @@ -1,52 +0,0 @@ -""" -module containing a parametrized tests testing cross-python -serialization via the pickle module. -""" -import py -import pytest -import _pytest._code - -pythonlist = ['python2.6', 'python2.7', 'python3.3'] -@pytest.fixture(params=pythonlist) -def python1(request, tmpdir): - picklefile = tmpdir.join("data.pickle") - return Python(request.param, picklefile) - -@pytest.fixture(params=pythonlist) -def python2(request, python1): - return Python(request.param, python1.picklefile) - -class Python: - def __init__(self, version, picklefile): - self.pythonpath = py.path.local.sysfind(version) - if not self.pythonpath: - pytest.skip("%r not found" %(version,)) - self.picklefile = picklefile - def dumps(self, obj): - dumpfile = self.picklefile.dirpath("dump.py") - dumpfile.write(_pytest._code.Source(""" - import pickle - f = open(%r, 'wb') - s = pickle.dump(%r, f, protocol=2) - f.close() - """ % (str(self.picklefile), obj))) - py.process.cmdexec("%s %s" %(self.pythonpath, dumpfile)) - - def load_and_is_true(self, expression): - loadfile = self.picklefile.dirpath("load.py") - loadfile.write(_pytest._code.Source(""" - import pickle - f = open(%r, 'rb') - obj = pickle.load(f) - f.close() - res = eval(%r) - if not res: - raise SystemExit(1) - """ % (str(self.picklefile), expression))) - print (loadfile) - py.process.cmdexec("%s %s" %(self.pythonpath, loadfile)) - -@pytest.mark.parametrize("obj", [42, {}, {1:3},]) -def test_basic_objects(python1, python2, obj): - python1.dumps(obj) - python2.load_and_is_true("obj == %s" % obj) |