Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test compatibility with persistent 4.6; test CPython with PURE_PYTHON #296

Merged
merged 1 commit into from Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .travis.yml
@@ -1,4 +1,5 @@
language: python

python:
- 2.7
- 3.5
Expand All @@ -8,6 +9,13 @@ python:
- pypy
- pypy3

jobs:
include:
# Special Linux builds
- name: "Python: 3.8, pure (no C extensions)"
python: 3.8
env: PURE_PYTHON=1

install:
- pip install -U pip
- pip install -U setuptools zc.buildout
Expand Down
7 changes: 7 additions & 0 deletions src/ZODB/tests/testCache.py
Expand Up @@ -383,6 +383,13 @@ def add(key, obj):
# to None actually go *down* by a few. Possibly it has to
# do with the lazy tracking of frames?
# (https://github.com/python/cpython/commit/5a625d0aa6a6d9ec6574ee8344b41d63dcb9897e)
#
# Likewise, on 3.8 with PURE_PYTHON it sometimes increases
# by 1; this is cleared up by a garbage collection (it's
# not clear where/why)
new_nones = rc(None)
if new_nones > nones:
gc.collect()
self.assertLessEqual(rc(None), nones)

def testTwoCaches(self):
Expand Down
10 changes: 2 additions & 8 deletions src/ZODB/tests/testConnectionSavepoint.py
Expand Up @@ -127,17 +127,11 @@ def testSavepointDoesCacheGC():
True

Making a savepoint at this time used to leave the cache holding the same
number of objects. Make sure the cache shrinks now instead.
number of objects. Make sure the cache shrinks now instead. (Implementations that use
weak references, such as PyPy, may need a garbage collection.)

>>> dummy = transaction.savepoint()

Jython needs a GC, and needs to actually access the cache data to be
sure the size is updated (it uses "eventually consistent" implementations for
its weak dictionaries):

>>> _ = gc.collect()
>>> _ = getattr(cn._cache, 'data', {}).values()
>>> _ = getattr(cn._cache, 'data', {}).keys()
>>> len(cn._cache) <= CACHESIZE + 1
True

Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/tests/testThreadedShutdown.py
Expand Up @@ -7,7 +7,7 @@

class ZODBClientThread(threading.Thread):

sleep_time = 15
sleep_time = 3

def __init__(self, db, test):
threading.Thread.__init__(self)
Expand Down
8 changes: 7 additions & 1 deletion tox.ini
@@ -1,5 +1,5 @@
[tox]
envlist = py27,py35,py36,py37,py38,pypy,pypy3
envlist = py27,py35,py36,py37,py38,pypy,pypy3,py38-pure

[testenv]
# ZODB.tests.testdocumentation needs to find
Expand All @@ -22,3 +22,9 @@ commands =
deps =
{[testenv]deps}
coverage

[testenv:py38-pure]
basepython =
python3.8
setenv =
PURE_PYTHON = 1