From 66073b630d648ed1e4ae7e8b00e95b8f40c6becf Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Fri, 26 Jan 2018 13:16:22 +0100 Subject: [PATCH 1/6] Update to persistent >= 4.2.3. There seems to be regression in persistent 4.2.3+ breaking the test when using the C implementation. --- buildout.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/buildout.cfg b/buildout.cfg index 6a294cf..848eddd 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -5,6 +5,7 @@ parts = interpreter test [versions] Persistence = +persistent = >= 4.2.3 [interpreter] recipe = zc.recipe.egg From 2889b2647fc10e5de9bb21dfa8747bf261023232 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Sat, 27 Jan 2018 11:42:15 +0100 Subject: [PATCH 2/6] Use the version of `PickleCache` matching the used `persistent` variant. --- src/Persistence/tests/test_persistent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Persistence/tests/test_persistent.py b/src/Persistence/tests/test_persistent.py index 1d1f25f..b9aa85d 100644 --- a/src/Persistence/tests/test_persistent.py +++ b/src/Persistence/tests/test_persistent.py @@ -19,7 +19,7 @@ from Persistence import IS_PYPY, IS_PURE from Persistence import Persistent -from persistent.picklecache import PickleCache +from persistent import PickleCache from persistent.TimeStamp import TimeStamp From fefc934133eb879452624bb953800a96091ac51e Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Mon, 29 Jan 2018 09:29:36 +0100 Subject: [PATCH 3/6] Fix tests as suggested by @jamadden. --- src/Persistence/tests/test_persistent.py | 27 +++++++----------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/src/Persistence/tests/test_persistent.py b/src/Persistence/tests/test_persistent.py index b9aa85d..bb99ee2 100644 --- a/src/Persistence/tests/test_persistent.py +++ b/src/Persistence/tests/test_persistent.py @@ -108,29 +108,18 @@ def test_oid_jar_attrs(self): self.jar.add(obj) - if not (IS_PURE or IS_PYPY): - # Can change oid of cache object since persistent 4.0.8 + # Can't change oid of cache object. + with self.assertRaises(ValueError): del obj._p_oid + + with self.assertRaises(ValueError): obj._p_oid = 12 + + with self.assertRaises(ValueError): del obj._p_jar + + with self.assertRaises(ValueError): obj._p_jar = 12 - else: - # Can't change oid of cache object. - def deloid(): - del obj._p_oid - self.assertRaises(ValueError, deloid) - - def setoid(): - obj._p_oid = 12 - self.assertRaises(ValueError, setoid) - - def deloid(): - del obj._p_jar - self.assertRaises(ValueError, deloid) - - def setoid(): - obj._p_jar = 12 - self.assertRaises(ValueError, setoid) def testChanged(self): obj = P() From a3e0036e98a74454a038533b474b9b8fcb249fcc Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Fri, 2 Feb 2018 09:22:02 +0100 Subject: [PATCH 4/6] Remove not needed pinning. (Works with both versions.) --- buildout.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/buildout.cfg b/buildout.cfg index 848eddd..6a294cf 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -5,7 +5,6 @@ parts = interpreter test [versions] Persistence = -persistent = >= 4.2.3 [interpreter] recipe = zc.recipe.egg From ab89d0f14de5224f8cd586e91252e770382f5b42 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Fri, 2 Feb 2018 09:22:20 +0100 Subject: [PATCH 5/6] Colorize by default. --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 84a702a..a89855b 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,7 @@ envlist = commands = {envbindir}/buildout -c {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} bootstrap {envbindir}/buildout -c {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} - {envbindir}/test {posargs:-v1} + {envbindir}/test {posargs:-vc1} skip_install = true deps = setuptools==33.1.1 From e619a6934fb5ed7dfe7c0491bc1bf99ef9d854c7 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Fri, 2 Feb 2018 09:24:25 +0100 Subject: [PATCH 6/6] Add change log entry. [skip ci] --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index 7add7c5..9135f74 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,7 @@ Changelog 3.0b3 (unreleased) ------------------ +- Make tests compatible with `persistent >= 4.2.3`. 3.0b2 (2017-11-27) ------------------