zopefoundation / zodbpickle

Fork of Python's pickle module to work with ZODB
Other
17 stars 15 forks source link

2.3: pytest is failing #70

Closed kloczek closed 2 years ago

kloczek commented 2 years ago

I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

kloczek commented 2 years ago

Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-zodbpickle-2.3-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-zodbpickle-2.3-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra --ignore src/zodbpickle/tests/test_pickle_2.py ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/zodbpickle-2.3 collected 283 items src/zodbpickle/tests/test_pickle.py ..FFFF. [ 2%] src/zodbpickle/tests/test_pickle_3.py FFFFFFFFFFFF.FFFFFFFFFFFFFFFFFFFsssFFFFFFFFFFFFFFF.FFFFFFFFFFFFFFF.......FFFFFFFFFFFFFFFFFsssssFFFFFFFF......... [ 42%] ..............................sss.......F......................F....FFF.................sssss................sss.......F......................F....... [ 95%] .............. [100%] ========================================================================== FAILURES ========================================================================== ________________________________________________________________ TestImportability.test_dump _________________________________________________________________ self = def test_dump(self): from zodbpickle.pickle import dump > self.assertIsInstance(dump, function_type) E AssertionError: is not an instance of src/zodbpickle/tests/test_pickle.py:36: AssertionError ________________________________________________________________ TestImportability.test_dumps ________________________________________________________________ self = def test_dumps(self): from zodbpickle.pickle import dumps > self.assertIsInstance(dumps, function_type) E AssertionError: is not an instance of src/zodbpickle/tests/test_pickle.py:40: AssertionError ________________________________________________________________ TestImportability.test_load _________________________________________________________________ self = def test_load(self): from zodbpickle.pickle import load > self.assertIsInstance(load, function_type) E AssertionError: is not an instance of src/zodbpickle/tests/test_pickle.py:28: AssertionError ________________________________________________________________ TestImportability.test_loads ________________________________________________________________ self = def test_loads(self): from zodbpickle.pickle import loads > self.assertIsInstance(loads, function_type) E AssertionError: is not an instance of src/zodbpickle/tests/test_pickle.py:32: AssertionError _______________________________________________________ AbstractPickleTests.test_appends_on_non_lists ________________________________________________________ self = def test_appends_on_non_lists(self): # Issue #17720 obj = REX_six([1, 2, 3]) for proto in protocols: if proto == 0: > self._check_pickling_with_opcode(obj, pickle.APPEND, proto) src/zodbpickle/tests/pickletester_3.py:1267: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = obj = , opcode = b'a', proto = 0 def _check_pickling_with_opcode(self, obj, opcode, proto): > pickled = self.dumps(obj, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1257: AttributeError _____________________________________________________ AbstractPickleTests.test_attribute_name_interning ______________________________________________________ self = @unittest.skipIf(_is_pypy, 'PyPy does not guarantee the identity of strings. ' 'See the discussion on ' 'http://pypy.readthedocs.org/en/latest/cpython_differences.html#object-identity-of-primitive-values-is-and-id') def test_attribute_name_interning(self): # Test that attribute names of pickled objects are interned when # unpickling. for proto in protocols: x = C() x.foo = 42 x.bar = "hello" > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1161: AttributeError ____________________________________________________________ AbstractPickleTests.test_bad_getattr ____________________________________________________________ self = @no_tracing def test_bad_getattr(self): x = BadGetattr() for proto in (0, 1, 2): > self.assertRaises(RuntimeError, self.dumps, x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1111: AttributeError _______________________________________________________________ AbstractPickleTests.test_bytes _______________________________________________________________ self = def test_bytes(self): for proto in protocols: for s in b'', b'xyz', b'xyz'*100: > p = self.dumps(s, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:673: AttributeError _________________________________________________________ AbstractPickleTests.test_corrupted_pickle __________________________________________________________ self = def test_corrupted_pickle(self): # Former C implementation produced corrupted pickles on these samples. # See https://github.com/zopefoundation/zodbpickle/pull/47 sample1 = ['a'] * 17509 > dumped = self.dumps(sample1, 0) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1283: AttributeError ___________________________________________________________ AbstractPickleTests.test_dict_chunking ___________________________________________________________ self = def test_dict_chunking(self): n = 10 # too small to chunk x = dict.fromkeys(list(range(n))) for proto in protocols: > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1022: AttributeError ___________________________________________________________ AbstractPickleTests.test_dynamic_class ___________________________________________________________ self = def test_dynamic_class(self): a = create_dynamic_class("my_dynamic_class", (object,)) copyreg.pickle(pickling_metaclass, pickling_metaclass.__reduce__) for proto in protocols: > s = self.dumps(a, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:759: AttributeError _____________________________________________________________ AbstractPickleTests.test_ellipsis ______________________________________________________________ self = def test_ellipsis(self): for proto in protocols: > s = self.dumps(..., proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:785: AttributeError _________________________________________________________ AbstractPickleTests.test_empty_bytestring __________________________________________________________ self = def test_empty_bytestring(self): # issue 11286 > empty = self.loads(b'\x80\x03U\x00q\x00.', encoding='koi8-r') E AttributeError: 'AbstractPickleTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:1215: AttributeError _______________________________________________________________ AbstractPickleTests.test_float _______________________________________________________________ self = def test_float(self): test_values = [0.0, 4.94e-324, 1e-310, 7e-308, 6.626e-34, 0.1, 0.5, 3.14, 263.44582062374053, 6.022e23, 1e30] test_values = test_values + [-x for x in test_values] for proto in protocols: for value in test_values: > pickle = self.dumps(value, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:728: AttributeError ___________________________________________________________ AbstractPickleTests.test_float_format ____________________________________________________________ args = (,), kwds = {} locale = , category = 6 orig_locale = 'LC_CTYPE=C.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C' loc = 'de_DE' def inner(*args, **kwds): try: import locale category = getattr(locale, catstr) orig_locale = locale.setlocale(category) except AttributeError: # if the test author gives us an invalid category string raise except: # cannot retrieve original locale, so do nothing locale = orig_locale = None else: for loc in locales: try: locale.setlocale(category, loc) break except: pass # now run the function, resetting the locale on exceptions try: > return func(*args, **kwds) /usr/lib64/python3.8/test/support/__init__.py:1755: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = @run_with_locale('LC_ALL', 'de_DE', 'fr_FR') def test_float_format(self): # make sure that floats are formatted locale independent with proto 0 > self.assertEqual(self.dumps(1.2, 0)[0:3], b'F1.') E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:735: AttributeError ________________________________________________________________ AbstractPickleTests.test_get ________________________________________________________________ self = def test_get(self): > self.assertRaises(KeyError, self.loads, b'g0\np0') E AttributeError: 'AbstractPickleTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:625: AttributeError ____________________________________________________________ AbstractPickleTests.test_global_ext1 ____________________________________________________________ self = def test_global_ext1(self): > self.produce_global_ext(0x00000001, pickle.EXT1) # smallest EXT1 code src/zodbpickle/tests/pickletester_3.py:983: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , extcode = 1, opcode = b'\x82' def produce_global_ext(self, extcode, opcode): e = ExtensionSaver(extcode) try: copyreg.add_extension(__name__, "MyList", extcode) x = MyList([1, 2, 3]) x.foo = 42 x.bar = "hello" # Dump using protocol 1 for comparison. > s1 = self.dumps(x, 1) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:960: AttributeError ____________________________________________________________ AbstractPickleTests.test_global_ext2 ____________________________________________________________ self = def test_global_ext2(self): > self.produce_global_ext(0x00000100, pickle.EXT2) # smallest EXT2 code src/zodbpickle/tests/pickletester_3.py:987: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , extcode = 256, opcode = b'\x83' def produce_global_ext(self, extcode, opcode): e = ExtensionSaver(extcode) try: copyreg.add_extension(__name__, "MyList", extcode) x = MyList([1, 2, 3]) x.foo = 42 x.bar = "hello" # Dump using protocol 1 for comparison. > s1 = self.dumps(x, 1) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:960: AttributeError ____________________________________________________________ AbstractPickleTests.test_global_ext4 ____________________________________________________________ self = def test_global_ext4(self): > self.produce_global_ext(0x00010000, pickle.EXT4) # smallest EXT4 code src/zodbpickle/tests/pickletester_3.py:992: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , extcode = 65536, opcode = b'\x84' def produce_global_ext(self, extcode, opcode): e = ExtensionSaver(extcode) try: copyreg.add_extension(__name__, "MyList", extcode) x = MyList([1, 2, 3]) x.foo = 42 x.bar = "hello" # Dump using protocol 1 for comparison. > s1 = self.dumps(x, 1) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:960: AttributeError _________________________________________________________ AbstractPickleTests.test_insecure_strings __________________________________________________________ self = def test_insecure_strings(self): # XXX Some of these tests are temporarily disabled insecure = [b"abc", b"2 + 2", # not quoted ## b"'abc' + 'def'", # not a single quoted string b"'abc", # quote is not closed b"'abc\"", # open quote and close quote don't match b"'abc' ?", # junk after close quote b"'\\'", # trailing backslash # Variations on issue #17710 b"'", b'"', b"' ", b"' ", b"' ", b"' ", b'" ', # some tests of the quoting rules ## b"'abc\"\''", ## b"'\\\\a\'\'\'\\\'\\\\\''", ] for b in insecure: buf = b"S" + b + b"\012p0\012." > self.assertRaises(ValueError, self.loads, buf) E AttributeError: 'AbstractPickleTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:650: AttributeError ______________________________________________________ AbstractPickleTests.test_int_pickling_efficiency ______________________________________________________ self = def test_int_pickling_efficiency(self): # Test compacity of int representation (see issue #12744) for proto in protocols: > sizes = [len(self.dumps(2**n, proto)) for n in range(70)] src/zodbpickle/tests/pickletester_3.py:1221: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .0 = > sizes = [len(self.dumps(2**n, proto)) for n in range(70)] E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1221: AttributeError _______________________________________________________________ AbstractPickleTests.test_ints ________________________________________________________________ self = def test_ints(self): import sys for proto in protocols: n = sys.maxsize while n: for expected in (-n, n): > s = self.dumps(expected, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:688: AttributeError ___________________________________________________________ AbstractPickleTests.test_large_pickles ___________________________________________________________ self = def test_large_pickles(self): # Test the correctness of internal buffering routines when handling # large data. for proto in protocols: data = (1, min, b'xy' * (30 * 1024), len) > dumped = self.dumps(data, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1208: AttributeError ___________________________________________________________ AbstractPickleTests.test_list_chunking ___________________________________________________________ self = def test_list_chunking(self): n = 10 # too small to chunk x = list(range(n)) for proto in protocols: > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1000: AttributeError _______________________________________________________ AbstractPickleTests.test_load_classic_instance _______________________________________________________ self = def test_load_classic_instance(self): # See issue5180. Test loading 2.x pickles that # contain an instance of old style class. for X, args in [(C, ()), (D, ('x',)), (E, ())]: xname = X.__name__.encode('ascii') # Protocol 0 (text mode pickle): """ 0: ( MARK 1: i INST '__main__ X' (MARK at 0) 15: p PUT 0 18: ( MARK 19: d DICT (MARK at 18) 20: p PUT 1 23: b BUILD 24: . STOP """ pickle0 = (b"(i__main__\n" b"X\n" b"p0\n" b"(dp1\nb.").replace(b'X', xname) > self.assertEqual(X(*args), self.loads(pickle0)) E AttributeError: 'AbstractPickleTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:519: AttributeError __________________________________________________________ AbstractPickleTests.test_load_from_data0 __________________________________________________________ self = def test_load_from_data0(self): > self.assertEqual(self._testdata, self.loads(DATA0)) E AttributeError: 'AbstractPickleTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:491: AttributeError __________________________________________________________ AbstractPickleTests.test_load_from_data1 __________________________________________________________ self = def test_load_from_data1(self): > self.assertEqual(self._testdata, self.loads(DATA1)) E AttributeError: 'AbstractPickleTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:494: AttributeError __________________________________________________________ AbstractPickleTests.test_load_from_data2 __________________________________________________________ self = def test_load_from_data2(self): > self.assertEqual(self._testdata, self.loads(DATA2)) E AttributeError: 'AbstractPickleTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:497: AttributeError _______________________________________________________________ AbstractPickleTests.test_long ________________________________________________________________ self = def test_long(self): for proto in protocols: # 256 bytes is where LONG4 begins. for nbits in 1, 8, 8*254, 8*255, 8*256, 8*257: nbase = 1 << nbits for npos in nbase-1, nbase, nbase+1: for n in npos, -npos: > pickle = self.dumps(n, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:710: AttributeError _______________________________________________________________ AbstractPickleTests.test_long1 _______________________________________________________________ self = def test_long1(self): x = 12345678910111213141516178920 for proto in protocols: > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:819: AttributeError _______________________________________________________________ AbstractPickleTests.test_long4 _______________________________________________________________ self = def test_long4(self): x = 12345678910111213141516178920 << (256*8) for proto in protocols: > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:827: AttributeError ________________________________________________________ AbstractPickleTests.test_many_puts_and_gets _________________________________________________________ self = def test_many_puts_and_gets(self): # Test that internal data structures correctly deal with lots of # puts/gets. keys = ("aaa" + str(i) for i in range(100)) large_dict = dict((k, [4, 5, 6]) for k in keys) obj = [dict(large_dict), dict(large_dict), dict(large_dict)] for proto in protocols: > dumped = self.dumps(obj, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1144: AttributeError _____________________________________________________________ AbstractPickleTests.test_maxint64 ______________________________________________________________ self = def test_maxint64(self): maxint64 = (1 << 63) - 1 data = b'I' + str(maxint64).encode("ascii") + b'\n.' > got = self.loads(data) E AttributeError: 'AbstractPickleTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:696: AttributeError _____________________________________________________________ AbstractPickleTests.test_metaclass _____________________________________________________________ self = def test_metaclass(self): a = use_metaclass() for proto in protocols: > s = self.dumps(a, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:751: AttributeError _______________________________________________________________ AbstractPickleTests.test_misc ________________________________________________________________ self = def test_misc(self): # test various datatypes not tested by testdata for proto in protocols: x = myint(4) > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:467: AttributeError ___________________________________________________________ AbstractPickleTests.test_negative_put ____________________________________________________________ self = def test_negative_put(self): # Issue #12847 dumped = b'Va\np-1\n.' > self.assertRaises(ValueError, self.loads, dumped) E AttributeError: 'AbstractPickleTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:1247: AttributeError __________________________________________________________ AbstractPickleTests.test_newobj_generic ___________________________________________________________ self = def test_newobj_generic(self): for proto in protocols: for C in myclasses: B = C.__base__ x = C(C.sample) x.foo = 42 > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:922: AttributeError ____________________________________________________________ AbstractPickleTests.test_newobj_list ____________________________________________________________ self = def test_newobj_list(self): x = MyList([1, 2, 3]) x.foo = 42 x.bar = "hello" for proto in protocols: > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:911: AttributeError _________________________________________________________ AbstractPickleTests.test_newobj_list_slots _________________________________________________________ self = def test_newobj_list_slots(self): x = SlotList([1, 2, 3]) x.foo = 42 x.bar = "hello" > s = self.dumps(x, 2) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1055: AttributeError __________________________________________________________ AbstractPickleTests.test_newobj_proxies ___________________________________________________________ self = def test_newobj_proxies(self): # NEWOBJ should use the __class__ rather than the raw type classes = myclasses[:] # Cannot create weakproxies to these classes for c in (MyInt, MyTuple): classes.remove(c) for proto in protocols: for C in classes: B = C.__base__ x = C(C.sample) x.foo = 42 p = weakref.proxy(x) > s = self.dumps(p, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:940: AttributeError ___________________________________________________________ AbstractPickleTests.test_newobj_tuple ____________________________________________________________ self = def test_newobj_tuple(self): x = MyTuple([1, 2, 3]) x.foo = 42 x.bar = "hello" for proto in protocols: > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:901: AttributeError __________________________________________________________ AbstractPickleTests.test_notimplemented ___________________________________________________________ self = def test_notimplemented(self): for proto in protocols: > s = self.dumps(NotImplemented, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:791: AttributeError ___________________________________________________________ AbstractPickleTests.test_pickle_to_2x ____________________________________________________________ self = def test_pickle_to_2x(self): # Pickle non-trivial data with protocol 2, expecting that it yields # the same result as Python 2.x did. # NOTE: this test is a bit too strong since we can produce different # bytecode that 2.x will still understand. > dumped = self.dumps(list(range(5)), 2) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1192: AttributeError __________________________________________________________ AbstractPickleTests.test_pop_empty_stack __________________________________________________________ self = def test_pop_empty_stack(self): # Test issue7455 s = b'0' > self.assertRaises((pickle.UnpicklingError, IndexError), self.loads, s) E AttributeError: 'AbstractPickleTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:746: AttributeError _______________________________________________________________ AbstractPickleTests.test_proto _______________________________________________________________ self = def test_proto(self): build_none = pickle.NONE + pickle.STOP for proto in protocols: expected = build_none if proto >= 2: expected = pickle.PROTO + bytes([proto]) + expected > p = self.dumps(None, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:803: AttributeError __________________________________________________________ AbstractPickleTests.test_recursive_dict ___________________________________________________________ self = def test_recursive_dict(self): d = {} d[1] = d for proto in protocols: > s = self.dumps(d, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:596: AttributeError __________________________________________________________ AbstractPickleTests.test_recursive_inst ___________________________________________________________ self = def test_recursive_inst(self): i = C() i.attr = i for proto in protocols: > s = self.dumps(i, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:605: AttributeError __________________________________________________________ AbstractPickleTests.test_recursive_list ___________________________________________________________ self = def test_recursive_list(self): l = [] l.append(l) for proto in protocols: > s = self.dumps(l, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:577: AttributeError __________________________________________________________ AbstractPickleTests.test_recursive_multi __________________________________________________________ self = def test_recursive_multi(self): l = [] d = {1:l} i = C() i.attr = d l.append(i) for proto in protocols: > s = self.dumps(l, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:617: AttributeError __________________________________________________________ AbstractPickleTests.test_recursive_tuple __________________________________________________________ self = def test_recursive_tuple(self): t = ([],) t[0].append(t) for proto in protocols: > s = self.dumps(t, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:586: AttributeError ________________________________________________________ AbstractPickleTests.test_reduce_bad_iterator ________________________________________________________ self = def test_reduce_bad_iterator(self): # Issue4176: crash when 4th and 5th items of __reduce__() # are not iterators class C(object): def __reduce__(self): # 4th item is not an iterator return list, (), None, [], None class D(object): def __reduce__(self): # 5th item is not an iterator return dict, (), None, None, [] # Protocol 0 is less strict and also accept iterables. for proto in protocols: try: > self.dumps(C(), proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1128: AttributeError _________________________________________________________ AbstractPickleTests.test_reduce_calls_base _________________________________________________________ self = def test_reduce_calls_base(self): for proto in protocols: x = REX_five() self.assertEqual(x._reduce_called, 0) > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1102: AttributeError _________________________________________________________ AbstractPickleTests.test_reduce_ex_called __________________________________________________________ self = def test_reduce_ex_called(self): for proto in protocols: x = REX_two() self.assertEqual(x._proto, None) > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1075: AttributeError _______________________________________________________ AbstractPickleTests.test_reduce_ex_calls_base ________________________________________________________ self = def test_reduce_ex_calls_base(self): for proto in protocols: x = REX_four() self.assertEqual(x._proto, None) > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1093: AttributeError ____________________________________________________ AbstractPickleTests.test_reduce_ex_overrides_reduce _____________________________________________________ self = def test_reduce_ex_overrides_reduce(self): for proto in protocols: x = REX_three() self.assertEqual(x._proto, None) > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1084: AttributeError ________________________________________________ AbstractPickleTests.test_reduce_overrides_default_reduce_ex _________________________________________________ self = def test_reduce_overrides_default_reduce_ex(self): for proto in protocols: x = REX_one() self.assertEqual(x._reduce_called, 0) > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1066: AttributeError ________________________________________________________ AbstractPickleTests.test_roundtrip_equality _________________________________________________________ self = def test_roundtrip_equality(self): expected = self._testdata for proto in protocols: > s = self.dumps(expected, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:486: AttributeError _______________________________________________________ AbstractPickleTests.test_setitems_on_non_dicts _______________________________________________________ self = def test_setitems_on_non_dicts(self): obj = REX_seven({1: -1, 2: -2, 3: -3}) for proto in protocols: if proto == 0: > self._check_pickling_with_opcode(obj, pickle.SETITEM, proto) src/zodbpickle/tests/pickletester_3.py:1275: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = obj = , opcode = b's', proto = 0 def _check_pickling_with_opcode(self, obj, opcode, proto): > pickled = self.dumps(obj, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1257: AttributeError ___________________________________________________________ AbstractPickleTests.test_short_tuples ____________________________________________________________ self = def test_short_tuples(self): # Map (proto, len(tuple)) to expected opcode. expected_opcode = {(0, 0): pickle.TUPLE, (0, 1): pickle.TUPLE, (0, 2): pickle.TUPLE, (0, 3): pickle.TUPLE, (0, 4): pickle.TUPLE, (1, 0): pickle.EMPTY_TUPLE, (1, 1): pickle.TUPLE, (1, 2): pickle.TUPLE, (1, 3): pickle.TUPLE, (1, 4): pickle.TUPLE, (2, 0): pickle.EMPTY_TUPLE, (2, 1): pickle.TUPLE1, (2, 2): pickle.TUPLE2, (2, 3): pickle.TUPLE3, (2, 4): pickle.TUPLE, (3, 0): pickle.EMPTY_TUPLE, (3, 1): pickle.TUPLE1, (3, 2): pickle.TUPLE2, (3, 3): pickle.TUPLE3, (3, 4): pickle.TUPLE, } a = () b = (1,) c = (1, 2) d = (1, 2, 3) e = (1, 2, 3, 4) for proto in protocols: for x in a, b, c, d, e: > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:865: AttributeError ___________________________________________________________ AbstractPickleTests.test_simple_newobj ___________________________________________________________ self = def test_simple_newobj(self): x = object.__new__(SimpleNewObj) # avoid __init__ x.abc = 666 for proto in protocols: > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:1045: AttributeError ____________________________________________________________ AbstractPickleTests.test_singletons _____________________________________________________________ self = def test_singletons(self): # Map (proto, singleton) to expected opcode. expected_opcode = {(0, None): pickle.NONE, (1, None): pickle.NONE, (2, None): pickle.NONE, (3, None): pickle.NONE, (0, True): pickle.INT, (1, True): pickle.INT, (2, True): pickle.NEWTRUE, (3, True): pickle.NEWTRUE, (0, False): pickle.INT, (1, False): pickle.INT, (2, False): pickle.NEWFALSE, (3, False): pickle.NEWFALSE, } for proto in protocols: for x in None, False, True: > s = self.dumps(x, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:890: AttributeError _____________________________________________________________ AbstractPickleTests.test_structseq _____________________________________________________________ self = def test_structseq(self): import time import os t = time.localtime() for proto in protocols: > s = self.dumps(t, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:769: AttributeError ______________________________________________________________ AbstractPickleTests.test_unicode ______________________________________________________________ self = def test_unicode(self): endcases = ['', '<\\u>', '<\\\\u1234>', '<\n>', '<\\>', '<\\\\U00012345>', # surrogates '<\\udc80>'] for proto in protocols: for u in endcases: > p = self.dumps(u, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:659: AttributeError ________________________________________________________ AbstractPickleTests.test_unicode_high_plane _________________________________________________________ self = def test_unicode_high_plane(self): t = '\\U00012345' for proto in protocols: > p = self.dumps(t, proto) E AttributeError: 'AbstractPickleTests' object has no attribute 'dumps' src/zodbpickle/tests/pickletester_3.py:666: AttributeError _________________________________________________________ AbstractPickleTests.test_unpickle_from_2x __________________________________________________________ self = def test_unpickle_from_2x(self): # Unpickle non-trivial data from Python 2.x. > loaded = self.loads(DATA3) E AttributeError: 'AbstractPickleTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:1170: AttributeError ____________________________________________________ AbstractPersistentPicklerTests.test_bin_persistence _____________________________________________________ self = def test_bin_persistence(self): self.id_count = 0 self.load_count = 0 L = list(range(10)) > self.assertEqual(self.loads(self.dumps(L, 1)), L) E AttributeError: 'AbstractPersistentPicklerTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:1653: AttributeError ______________________________________________________ AbstractPersistentPicklerTests.test_persistence _______________________________________________________ self = def test_persistence(self): self.id_count = 0 self.load_count = 0 L = list(range(10)) > self.assertEqual(self.loads(self.dumps(L)), L) E AttributeError: 'AbstractPersistentPicklerTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:1645: AttributeError ________________________________________________ AbstractPicklerUnpicklerObjectTests.test_clear_pickler_memo _________________________________________________ self = def setUp(self): > assert self.pickler_class E AssertionError src/zodbpickle/tests/pickletester_3.py:1664: AssertionError ______________________________________________ AbstractPicklerUnpicklerObjectTests.test_functional_noload_dict _______________________________________________ self = def setUp(self): > assert self.pickler_class E AssertionError src/zodbpickle/tests/pickletester_3.py:1664: AssertionError __________________________________________ AbstractPicklerUnpicklerObjectTests.test_functional_noload_dict_subclass __________________________________________ self = def setUp(self): > assert self.pickler_class E AssertionError src/zodbpickle/tests/pickletester_3.py:1664: AssertionError ______________________________________________ AbstractPicklerUnpicklerObjectTests.test_functional_noload_list _______________________________________________ self = def setUp(self): > assert self.pickler_class E AssertionError src/zodbpickle/tests/pickletester_3.py:1664: AssertionError __________________________________________ AbstractPicklerUnpicklerObjectTests.test_functional_noload_list_subclass __________________________________________ self = def setUp(self): > assert self.pickler_class E AssertionError src/zodbpickle/tests/pickletester_3.py:1664: AssertionError ___________________________________________ AbstractPicklerUnpicklerObjectTests.test_multiple_unpicklings_seekable ___________________________________________ self = def setUp(self): > assert self.pickler_class E AssertionError src/zodbpickle/tests/pickletester_3.py:1664: AssertionError __________________________________________ AbstractPicklerUnpicklerObjectTests.test_multiple_unpicklings_unseekable __________________________________________ self = def setUp(self): > assert self.pickler_class E AssertionError src/zodbpickle/tests/pickletester_3.py:1664: AssertionError ___________________________________________________ AbstractPicklerUnpicklerObjectTests.test_noload_object ___________________________________________________ self = def setUp(self): > assert self.pickler_class E AssertionError src/zodbpickle/tests/pickletester_3.py:1664: AssertionError _______________________________________________ AbstractPicklerUnpicklerObjectTests.test_priming_pickler_memo ________________________________________________ self = def setUp(self): > assert self.pickler_class E AssertionError src/zodbpickle/tests/pickletester_3.py:1664: AssertionError ______________________________________________ AbstractPicklerUnpicklerObjectTests.test_priming_unpickler_memo _______________________________________________ self = def setUp(self): > assert self.pickler_class E AssertionError src/zodbpickle/tests/pickletester_3.py:1664: AssertionError _____________________________________________ AbstractPicklerUnpicklerObjectTests.test_reusing_unpickler_objects _____________________________________________ self = def setUp(self): > assert self.pickler_class E AssertionError src/zodbpickle/tests/pickletester_3.py:1664: AssertionError ___________________________________________ AbstractPicklerUnpicklerObjectTests.test_unpickling_buffering_readline ___________________________________________ self = def setUp(self): > assert self.pickler_class E AssertionError src/zodbpickle/tests/pickletester_3.py:1664: AssertionError ____________________________________________________ AbstractDispatchTableTests.test_class_dispatch_table ____________________________________________________ self = def test_class_dispatch_table(self): # A dispatch_table attribute can be specified class-wide > dt = self.get_dispatch_table() E AttributeError: 'AbstractDispatchTableTests' object has no attribute 'get_dispatch_table' src/zodbpickle/tests/pickletester_3.py:1949: AttributeError ___________________________________________________ AbstractDispatchTableTests.test_default_dispatch_table ___________________________________________________ self = def test_default_dispatch_table(self): # No dispatch_table attribute by default f = io.BytesIO() > p = self.pickler_class(f, 0) E AttributeError: 'AbstractDispatchTableTests' object has no attribute 'pickler_class' src/zodbpickle/tests/pickletester_3.py:1942: AttributeError __________________________________________________ AbstractDispatchTableTests.test_instance_dispatch_table ___________________________________________________ self = def test_instance_dispatch_table(self): # A dispatch_table attribute can also be specified instance-wide > dt = self.get_dispatch_table() E AttributeError: 'AbstractDispatchTableTests' object has no attribute 'get_dispatch_table' src/zodbpickle/tests/pickletester_3.py:1965: AttributeError _____________________________________________________ AbstractBytestrTests.test_load_long_str_protocol_1 _____________________________________________________ self = def test_load_long_str_protocol_1(self): """ Test long str with protocol=1 python 2: pickle.dumps('x'*300, protocol=1) """ > self.unpickleEqual( b'T,\x01\x00\x00xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxq\x00.', b'x'*300) src/zodbpickle/tests/pickletester_3.py:1353: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = data = b'T,\x01\x00\x00xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxq\x00.' unpickled = b'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' def unpickleEqual(self, data, unpickled): > loaded = self.loads(data, encoding="bytes") E AttributeError: 'AbstractBytestrTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:1305: AttributeError _______________________________________________________ AbstractBytestrTests.test_load_str_protocol_0 ________________________________________________________ self = def test_load_str_protocol_0(self): """ Test str from protocol=0 python 2: pickle.dumps('bytestring \x00\xa0', protocol=0) """ > self.unpickleEqual( b"S'bytestring \\x00\\xa0'\np0\n.", b'bytestring \x00\xa0') src/zodbpickle/tests/pickletester_3.py:1311: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , data = b"S'bytestring \\x00\\xa0'\np0\n." unpickled = b'bytestring \x00\xa0' def unpickleEqual(self, data, unpickled): > loaded = self.loads(data, encoding="bytes") E AttributeError: 'AbstractBytestrTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:1305: AttributeError _______________________________________________________ AbstractBytestrTests.test_load_str_protocol_1 ________________________________________________________ self = def test_load_str_protocol_1(self): """ Test str from protocol=1 python 2: pickle.dumps('bytestring \x00\xa0', protocol=1) """ > self.unpickleEqual( b'U\rbytestring \x00\xa0q\x00.', b'bytestring \x00\xa0') src/zodbpickle/tests/pickletester_3.py:1318: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , data = b'U\rbytestring \x00\xa0q\x00.' unpickled = b'bytestring \x00\xa0' def unpickleEqual(self, data, unpickled): > loaded = self.loads(data, encoding="bytes") E AttributeError: 'AbstractBytestrTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:1305: AttributeError _______________________________________________________ AbstractBytestrTests.test_load_str_protocol_2 ________________________________________________________ self = def test_load_str_protocol_2(self): """ Test str from protocol=2 python 2: pickle.dumps('bytestring \x00\xa0', protocol=2) """ > self.unpickleEqual( b'\x80\x02U\rbytestring \x00\xa0q\x00.', b'bytestring \x00\xa0') src/zodbpickle/tests/pickletester_3.py:1325: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , data = b'\x80\x02U\rbytestring \x00\xa0q\x00.' unpickled = b'bytestring \x00\xa0' def unpickleEqual(self, data, unpickled): > loaded = self.loads(data, encoding="bytes") E AttributeError: 'AbstractBytestrTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:1305: AttributeError _____________________________________________________ AbstractBytestrTests.test_load_unicode_protocol_0 ______________________________________________________ self = def test_load_unicode_protocol_0(self): """ Test unicode with protocol=0 python 2: pickle.dumps(u"\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440", protocol=0) """ > self.unpickleEqual( b'V\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440\np0\n.', '\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440') src/zodbpickle/tests/pickletester_3.py:1332: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = data = b'V\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440\np0\n.' unpickled = '\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440' def unpickleEqual(self, data, unpickled): > loaded = self.loads(data, encoding="bytes") E AttributeError: 'AbstractBytestrTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:1305: AttributeError _____________________________________________________ AbstractBytestrTests.test_load_unicode_protocol_1 ______________________________________________________ self = def test_load_unicode_protocol_1(self): """ Test unicode with protocol=1 python 2: pickle.dumps(u"\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440", protocol=1) """ > self.unpickleEqual( b'X\x12\x00\x00\x00\xd0\x9a\xd0\xbe\xd0\xbc\xd0\xbf\xd1\x8c\xd1\x8e\xd1\x82\xd0\xb5\xd1\x80q\x00.', '\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440') src/zodbpickle/tests/pickletester_3.py:1339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = data = b'X\x12\x00\x00\x00\xd0\x9a\xd0\xbe\xd0\xbc\xd0\xbf\xd1\x8c\xd1\x8e\xd1\x82\xd0\xb5\xd1\x80q\x00.' unpickled = '\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440' def unpickleEqual(self, data, unpickled): > loaded = self.loads(data, encoding="bytes") E AttributeError: 'AbstractBytestrTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:1305: AttributeError _____________________________________________________ AbstractBytestrTests.test_load_unicode_protocol_2 ______________________________________________________ self = def test_load_unicode_protocol_2(self): """ Test unicode with protocol=1 python 2: pickle.dumps(u"\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440", protocol=2) """ > self.unpickleEqual( b'\x80\x02X\x12\x00\x00\x00\xd0\x9a\xd0\xbe\xd0\xbc\xd0\xbf\xd1\x8c\xd1\x8e\xd1\x82\xd0\xb5\xd1\x80q\x00.', '\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440') src/zodbpickle/tests/pickletester_3.py:1346: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = data = b'\x80\x02X\x12\x00\x00\x00\xd0\x9a\xd0\xbe\xd0\xbc\xd0\xbf\xd1\x8c\xd1\x8e\xd1\x82\xd0\xb5\xd1\x80q\x00.' unpickled = '\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440' def unpickleEqual(self, data, unpickled): > loaded = self.loads(data, encoding="bytes") E AttributeError: 'AbstractBytestrTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:1305: AttributeError _______________________________________________________ AbstractBytesFallbackTests.test_load_instance ________________________________________________________ self = def test_load_instance(self): r"""Test instance pickle. Python 2: pickle.dumps({'x': 'ascii', 'y': '\xff'}) """ > self.unpickleEqual( b"(dp0\nS'y'\np1\nS'\\xff'\np2\nsS'x'\np3\nS'ascii'\np4\ns.", {'x': 'ascii', 'y': b'\xff'}) src/zodbpickle/tests/pickletester_3.py:1366: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = data = b"(dp0\nS'y'\np1\nS'\\xff'\np2\nsS'x'\np3\nS'ascii'\np4\ns.", unpickled = {'x': 'ascii', 'y': b'\xff'} def unpickleEqual(self, data, unpickled): > loaded = self.loads(data, errors="bytes") E AttributeError: 'AbstractBytesFallbackTests' object has no attribute 'loads' src/zodbpickle/tests/pickletester_3.py:1359: AttributeError ______________________________________________________________ PyPicklerTests.test_pickle_to_2x ______________________________________________________________ self = def test_pickle_to_2x(self): # Pickle non-trivial data with protocol 2, expecting that it yields # the same result as Python 2.x did. # NOTE: this test is a bit too strong since we can produce different # bytecode that 2.x will still understand. dumped = self.dumps(list(range(5)), 2) > self.assertEqual(dumped, DATA4) E AssertionError: b'\x80\x02]q\x00(K\x00K\x01K\x02K\x03K\x04e.' != b'\x80\x02c__builtin__\nxrange\nq\x00K\x00K\x05K\x01\x87q\x01Rq\x02.' src/zodbpickle/tests/pickletester_3.py:1193: AssertionError ____________________________________________________________ PyPicklerTests.test_unpickle_from_2x ____________________________________________________________ self = def test_unpickle_from_2x(self): # Unpickle non-trivial data from Python 2.x. loaded = self.loads(DATA3) self.assertEqual(loaded, set([1, 2])) loaded = self.loads(DATA4) > self.assertEqual(type(loaded), type(list(range(0)))) E AssertionError: != src/zodbpickle/tests/pickletester_3.py:1173: AssertionError _____________________________________________________ PyPicklerBytestrTests.test_load_unicode_protocol_0 _____________________________________________________ self = def test_load_unicode_protocol_0(self): """ Test unicode with protocol=0 python 2: pickle.dumps(u"\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440", protocol=0) """ > self.unpickleEqual( b'V\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440\np0\n.', '\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440') src/zodbpickle/tests/pickletester_3.py:1332: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ src/zodbpickle/tests/pickletester_3.py:1306: in unpickleEqual self.assertEqual(loaded, unpickled) E AssertionError: 'Компьютер' != '\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440' E - Компьютер E + \u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 _____________________________________________________ PyPicklerBytestrTests.test_load_unicode_protocol_1 _____________________________________________________ self = def test_load_unicode_protocol_1(self): """ Test unicode with protocol=1 python 2: pickle.dumps(u"\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440", protocol=1) """ > self.unpickleEqual( b'X\x12\x00\x00\x00\xd0\x9a\xd0\xbe\xd0\xbc\xd0\xbf\xd1\x8c\xd1\x8e\xd1\x82\xd0\xb5\xd1\x80q\x00.', '\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440') src/zodbpickle/tests/pickletester_3.py:1339: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ src/zodbpickle/tests/pickletester_3.py:1306: in unpickleEqual self.assertEqual(loaded, unpickled) E AssertionError: 'Компьютер' != '\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440' E - Компьютер E + \u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 _____________________________________________________ PyPicklerBytestrTests.test_load_unicode_protocol_2 _____________________________________________________ self = def test_load_unicode_protocol_2(self): """ Test unicode with protocol=1 python 2: pickle.dumps(u"\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440", protocol=2) """ > self.unpickleEqual( b'\x80\x02X\x12\x00\x00\x00\xd0\x9a\xd0\xbe\xd0\xbc\xd0\xbf\xd1\x8c\xd1\x8e\xd1\x82\xd0\xb5\xd1\x80q\x00.', '\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440') src/zodbpickle/tests/pickletester_3.py:1346: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ src/zodbpickle/tests/pickletester_3.py:1306: in unpickleEqual self.assertEqual(loaded, unpickled) E AssertionError: 'Компьютер' != '\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440' E - Компьютер E + \u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 ___________________________________________________________ InMemoryPickleTests.test_pickle_to_2x ____________________________________________________________ self = def test_pickle_to_2x(self): # Pickle non-trivial data with protocol 2, expecting that it yields # the same result as Python 2.x did. # NOTE: this test is a bit too strong since we can produce different # bytecode that 2.x will still understand. dumped = self.dumps(list(range(5)), 2) > self.assertEqual(dumped, DATA4) E AssertionError: b'\x80\x02]q\x00(K\x00K\x01K\x02K\x03K\x04e.' != b'\x80\x02c__builtin__\nxrange\nq\x00K\x00K\x05K\x01\x87q\x01Rq\x02.' src/zodbpickle/tests/pickletester_3.py:1193: AssertionError _________________________________________________________ InMemoryPickleTests.test_unpickle_from_2x __________________________________________________________ self = def test_unpickle_from_2x(self): # Unpickle non-trivial data from Python 2.x. loaded = self.loads(DATA3) self.assertEqual(loaded, set([1, 2])) loaded = self.loads(DATA4) > self.assertEqual(type(loaded), type(list(range(0)))) E AssertionError: != src/zodbpickle/tests/pickletester_3.py:1173: AssertionError ================================================================== short test summary info =================================================================== SKIPPED [3] src/zodbpickle/tests/pickletester_3.py:1236: test is only meaningful on 32-bit builds SKIPPED [3] src/zodbpickle/tests/pickletester_3.py:1249: test is only meaningful on 32-bit builds SKIPPED [3] src/zodbpickle/tests/pickletester_3.py:1240: test is only meaningful on 32-bit builds SKIPPED [4] ../../../../../usr/lib64/python3.8/test/support/__init__.py:1876: not enough memory: 4.0G minimum needed SKIPPED [4] ../../../../../usr/lib64/python3.8/test/support/__init__.py:1876: not enough memory: 8.0G minimum needed SKIPPED [2] ../../../../../usr/lib64/python3.8/test/support/__init__.py:1876: not enough memory: 6.0G minimum needed FAILED src/zodbpickle/tests/test_pickle.py::TestImportability::test_dump - AssertionError: is not an instance of is not an instance of is not an instance of is not an instance of != FAILED src/zodbpickle/tests/test_pickle_3.py::PyPicklerBytestrTests::test_load_unicode_protocol_0 - AssertionError: 'Компьютер' != '\\u041a\\u043e\\u043c\\... FAILED src/zodbpickle/tests/test_pickle_3.py::PyPicklerBytestrTests::test_load_unicode_protocol_1 - AssertionError: 'Компьютер' != '\\u041a\\u043e\\u043c\\... FAILED src/zodbpickle/tests/test_pickle_3.py::PyPicklerBytestrTests::test_load_unicode_protocol_2 - AssertionError: 'Компьютер' != '\\u041a\\u043e\\u043c\\... FAILED src/zodbpickle/tests/test_pickle_3.py::InMemoryPickleTests::test_pickle_to_2x - AssertionError: b'\x80\x02]q\x00(K\x00K\x01K\x02K\x03K\x04e.' != b'\... FAILED src/zodbpickle/tests/test_pickle_3.py::InMemoryPickleTests::test_unpickle_from_2x - AssertionError: != ========================================================= 97 failed, 167 passed, 19 skipped in 5.14s ========================================================= ```
icemac commented 2 years ago

Use zope.testrunner to run the tests.

kloczek commented 2 years ago

As at the monebt pytest is de facto standard pytest should be supported as well. Just retested 2.4 and pytest is failing a bit different now

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-zodbpickle-2.4-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-zodbpickle-2.4-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.3, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/zodbpickle-2.4
collected 8 items

src/zodbpickle/tests/test_compile_flags.py .                                                                                                                         [ 12%]
src/zodbpickle/tests/test_pickle.py ..FFFF.                                                                                                                          [100%]

================================================================================= FAILURES =================================================================================
_______________________________________________________________________ TestImportability.test_dump ________________________________________________________________________

self = <zodbpickle.tests.test_pickle.TestImportability testMethod=test_dump>

    def test_dump(self):
        from zodbpickle.pickle import dump
>       self.assertIsInstance(dump, function_type)
E       AssertionError: <function _dump at 0x7f9b5ea3e550> is not an instance of <class 'builtin_function_or_method'>

src/zodbpickle/tests/test_pickle.py:36: AssertionError
_______________________________________________________________________ TestImportability.test_dumps _______________________________________________________________________

self = <zodbpickle.tests.test_pickle.TestImportability testMethod=test_dumps>

    def test_dumps(self):
        from zodbpickle.pickle import dumps
>       self.assertIsInstance(dumps, function_type)
E       AssertionError: <function _dumps at 0x7f9b5ea3e5e0> is not an instance of <class 'builtin_function_or_method'>

src/zodbpickle/tests/test_pickle.py:40: AssertionError
_______________________________________________________________________ TestImportability.test_load ________________________________________________________________________

self = <zodbpickle.tests.test_pickle.TestImportability testMethod=test_load>

    def test_load(self):
        from zodbpickle.pickle import load
>       self.assertIsInstance(load, function_type)
E       AssertionError: <function _load at 0x7f9b5ea3e670> is not an instance of <class 'builtin_function_or_method'>

src/zodbpickle/tests/test_pickle.py:28: AssertionError
_______________________________________________________________________ TestImportability.test_loads _______________________________________________________________________

self = <zodbpickle.tests.test_pickle.TestImportability testMethod=test_loads>

    def test_loads(self):
        from zodbpickle.pickle import loads
>       self.assertIsInstance(loads, function_type)
E       AssertionError: <function _loads at 0x7f9b5ea3e700> is not an instance of <class 'builtin_function_or_method'>

src/zodbpickle/tests/test_pickle.py:32: AssertionError
========================================================================= short test summary info ==========================================================================
FAILED src/zodbpickle/tests/test_pickle.py::TestImportability::test_dump - AssertionError: <function _dump at 0x7f9b5ea3e550> is not an instance of <class 'builtin_funct...
FAILED src/zodbpickle/tests/test_pickle.py::TestImportability::test_dumps - AssertionError: <function _dumps at 0x7f9b5ea3e5e0> is not an instance of <class 'builtin_fun...
FAILED src/zodbpickle/tests/test_pickle.py::TestImportability::test_load - AssertionError: <function _load at 0x7f9b5ea3e670> is not an instance of <class 'builtin_funct...
FAILED src/zodbpickle/tests/test_pickle.py::TestImportability::test_loads - AssertionError: <function _loads at 0x7f9b5ea3e700> is not an instance of <class 'builtin_fun...
======================================================================= 4 failed, 4 passed in 0.21s ========================================================================

BTW looks like test suite is installed. Here is the patch to exclude test suite files from what is installed.

--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -12,3 +12,4 @@
 include *.sh
 recursive-include patches *.diff
 recursive-include src *.c
+exclude src/zodbpickle/tests
mgedmin commented 2 years ago

pytest is very popular, yes, but it's not what we use across the entire ZopeFoundation repository, and porting the test suite to work properly with pytest is a large job that nobody has volunteered to do so far.

d-maurer commented 2 years ago

Marius Gedminas wrote at 2022-9-18 07:52 -0700:

pytest is very popular, yes, but it's not what we use across the entire ZopeFoundation repository, and porting the test suite to work properly with pytest is a large job that nobody has volunteered to do so far.

In addition, many of the suites make important use of the zope.testrunner feature (hierarchical) layer. This allows related tests to share a common setup (set up once before those tests, shared by the tests and torn down after them). It is important because many tests have a very expensive setup; sharing allows to reduce testing time.

I asked our pytest protagonist in the past whether pytest has a comparable feature -- and have gotten no answer.

kloczek commented 2 years ago

Most of the zope modules which I have packaged have no problems with use pytest.

[tkloczko@devel-g2v SPECS]$ ls python*zope*
python-sphinxcontrib-zopeext.spec  python-zope-event.spec       python-zope-i18nmessageid.spec  python-zope-testing.spec
python-zope-component.spec         python-zope-exceptions.spec  python-zope-interface.spec      python-zope-testrunner.spec
python-zope-configuration.spec     python-zope-hookable.spec    python-zope-schema.spec
[tkloczko@devel-g2v SPECS]$ ls python*zope* |xargs grep %bcond_with.*failing_tests
python-zope-component.spec:%bcond_with  failing_tests   # By default skip some failing test units
python-zope-configuration.spec:%bcond_with      failing_tests   # By default skip some failing test units
python-zope-exceptions.spec:%bcond_with failing_tests   # By default skip some failing test units
python-zope-testrunner.spec:%bcond_with failing_tests   # By default skip some failing test units
[tkloczko@devel-g2v SPECS]$ ls python*zope* |xargs grep %bcond_with.*failing_tests -l | xargs grep BUG
python-zope-component.spec:# BUG: pytest is failing https://github.com/zopefoundation/zope.component/issues/64
python-zope-configuration.spec:# BUG: pytest is failing https://github.com/zopefoundation/zope.configuration/issues/55
python-zope-exceptions.spec:# BUG: pytest is failing https://github.com/zopefoundation/zope.exceptions/issues/21
python-zope-exceptions.spec:# BUG: sphinx warnings https://github.com/zopefoundation/zope.exceptions/issues/22
python-zope-testrunner.spec:# BUG: test suite is failing https://github.com/zopefoundation/zope.testrunner/issues/136

Nevertheless currently testrunner is way behind of what pytest can do/provide. Personnally currently I don't see to much sense to stick to testrunner as it barrely evolving (but this is only my personall opinion and I fully understand that someone may not agree). testrunner was born before pytest and currently it is quite big set of reasons why +95% of all modules are now tesable using pytest. With some additional modyfications I've reached even higher ratio

[tkloczko@devel-g2v SPECS]$ grep ^%pytest python-*spec -l | wc -l; ls -1 python-*.spec | wc -l
998
1025

But all that is a bit off topic.

mgedmin commented 2 years ago

In addition, many of the suites make important use of the zope.testrunner feature (hierarchical) layer. This allows related tests to share a common setup (set up once before those tests, shared by the tests and torn down after them). It is important because many tests have a very expensive setup; sharing allows to reduce testing time.

(Note that zodbpickle doesn't use layers, so this is technically offtopic for this issue.)

pytest has session-level fixtures which run setup and teardown at most once during the test session. I'm not sure pytest orders tests by fixture use, so there are any test suites that rely on zope.testrunner layers to clean up any global monkey-patching before running the next test layer, that might not work after porting to pytest. Also, pytest has no direct support for running tests in a subprocess, which zope.testrunner uses to handle layers that raise NotImplementedError in the layer teardown. (You can use a plugin like pytest-xdist to run tests in a different process, but you won't get the automatic grouping by test layer.)

mgedmin commented 2 years ago

Personnally currently I don't see to much sense to stick to testrunner as it barrely evolving (but this is only my personall opinion and I fully understand that someone may not agree).

As I said, migration takes work. Even if a test suite runs under pytest, have you verified that it runs the same tests? Like here you're showing us a pytest run with 8 tests, but the actual zodbpickle test suite contains 427 tests. The reason most of them weren't picked up is that we're relying on zope.testrunner's feature where it calls test_suite in each test module to collect the tests, and we use that here to pick the right test file, depending on the major Python version.

Have you verified that the other packages where you chose to use pytest actually run all the tests? We rely on test_suite() quite often, e.g. to provide custom setUp/tearDown/globs to different doctest files.

It's all solvable, but solving it takes work.

kloczek commented 1 year ago

Have you verified that the other packages where you chose to use pytest actually run all the tests? We rely on test_suite() quite often, e.g. to provide custom setUp/tearDown/globs to different doctest files.

It's all solvable, but solving it takes work.

And that is easy to explain because pyetst only scans for units test_.py files. and in src/zodbpickle/tests/ there are pickle.py so to allow pytest scan for more units some files needs to be renamed.