Skip to content

Commit 552f358

Browse files
Add more explicit skips.
1 parent 1f7038c commit 552f358

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

Lib/test/pickletester.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,6 +2762,8 @@ def test_recursive_tuple_and_dict_like_key(self):
27622762
self._test_recursive_tuple_and_dict_key(REX_seven, asdict=lambda x: x.table)
27632763

27642764
def test_recursive_set(self):
2765+
if self.py_version < (3, 4):
2766+
self.skipTest('not supported in Python < 3.4')
27652767
# Set containing an immutable object containing the original set.
27662768
y = set()
27672769
y.add(K(y))
@@ -2840,7 +2842,7 @@ def _test_recursive_collection_and_inst(self, factory, oldminproto=None):
28402842
for proto in protocols:
28412843
with self.subTest(proto=proto):
28422844
if self.py_version < (3, 4) and proto < oldminproto:
2843-
self.skipTest('not supported in Python < 3.4')
2845+
self.skipTest(f'requires protocol {oldminproto} in Python < 3.4')
28442846
s = self.dumps(o, proto)
28452847
x = self.loads(s)
28462848
self.assertIsInstance(x, t)
@@ -3588,10 +3590,14 @@ def test_complex_newobj(self):
35883590
self.assert_is_copy(x, y)
35893591

35903592
def test_complex_newobj_ex(self):
3593+
if self.py_version < (3, 4):
3594+
self.skipTest('not supported in Python < 3.4')
35913595
x = ComplexNewObjEx.__new__(ComplexNewObjEx, 0xface) # avoid __init__
35923596
x.abc = 666
3593-
for proto in protocols if self.py_version >= (3, 6) else protocols[4:]:
3597+
for proto in protocols:
35943598
with self.subTest(proto=proto):
3599+
if self.py_version < (3, 6) and proto < 4:
3600+
self.skipTest('requires protocol 4 in Python < 3.6')
35953601
s = self.dumps(x, proto)
35963602
if proto < 1:
35973603
if self.py_version >= (3, 7):
@@ -3749,7 +3755,7 @@ def test_appends_on_non_lists(self):
37493755
self._check_pickling_with_opcode(obj, pickle.APPEND, proto)
37503756
else:
37513757
if self.py_version < (3, 0):
3752-
self.skipTest('not supported in Python < 3.0')
3758+
self.skipTest('not supported in Python 2')
37533759
self._check_pickling_with_opcode(obj, pickle.APPENDS, proto)
37543760

37553761
def test_setitems_on_non_dicts(self):
@@ -3815,6 +3821,8 @@ def check_frame_opcodes(self, pickled):
38153821
@support.skip_if_pgo_task
38163822
@support.requires_resource('cpu')
38173823
def test_framing_many_objects(self):
3824+
if self.py_version < (3, 4):
3825+
self.skipTest('not supported in Python < 3.4')
38183826
obj = list(range(10**5))
38193827
for proto in range(4, pickle.HIGHEST_PROTOCOL + 1):
38203828
with self.subTest(proto=proto):
@@ -3830,6 +3838,8 @@ def test_framing_many_objects(self):
38303838
self.check_frame_opcodes(pickled)
38313839

38323840
def test_framing_large_objects(self):
3841+
if self.py_version < (3, 4):
3842+
self.skipTest('not supported in Python < 3.4')
38333843
N = 1024 * 1024
38343844
small_items = [[i] for i in range(10)]
38353845
obj = [b'x' * N, *small_items, b'y' * N, 'z' * N]
@@ -3863,8 +3873,8 @@ def test_framing_large_objects(self):
38633873
self.check_frame_opcodes(pickled)
38643874

38653875
def test_optional_frames(self):
3866-
if pickle.HIGHEST_PROTOCOL < 4:
3867-
return
3876+
if self.py_version < (3, 4):
3877+
self.skipTest('not supported in Python < 3.4')
38683878

38693879
def remove_frames(pickled, keep_frame=None):
38703880
"""Remove frame opcodes from the given pickle."""
@@ -3906,6 +3916,9 @@ def remove_frames(pickled, keep_frame=None):
39063916

39073917
@support.skip_if_pgo_task
39083918
def test_framed_write_sizes_with_delayed_writer(self):
3919+
if self.py_version < (3, 4):
3920+
self.skipTest('not supported in Python < 3.4')
3921+
39093922
class ChunkAccumulator:
39103923
"""Accumulate pickler output in a list of raw chunks."""
39113924
def __init__(self):

0 commit comments

Comments
 (0)