Commit 7502fa4f authored by Éloi Rivard's avatar Éloi Rivard

tox tests with zodb4

parent 475f420d
...@@ -5,19 +5,27 @@ sudo: false ...@@ -5,19 +5,27 @@ sudo: false
matrix: matrix:
include: include:
- python: 2.7 - python: 2.7
env: TOXENV=py27 env: TOXENV=py27-zodb4
- python: 2.7
env: TOXENV=py27-zodb5
- python: 3.4
env: TOXENV=py34-zodb4
- python: 3.4 - python: 3.4
env: TOXENV=py34 env: TOXENV=py34-zodb5
- python: 3.5 - python: 3.5
env: TOXENV=py35 env: TOXENV=py35-zodb4
- python: 3.5
env: TOXENV=py35-zodb5
- python: 3.6
env: TOXENV=py36-zodb4
- python: 3.6 - python: 3.6
env: TOXENV=py36 env: TOXENV=py36-zodb5
- python: 3.7 - python: 3.7
env: TOXENV=py37 env: TOXENV=py37-zodb5
dist: xenial dist: xenial
sudo: true sudo: true
- python: 3.8-dev - python: 3.8-dev
env: TOXENV=py38 env: TOXENV=py38-zodb5
dist: xenial dist: xenial
sudo: true sudo: true
allow_failures: allow_failures:
......
...@@ -103,3 +103,4 @@ Contributors ...@@ -103,3 +103,4 @@ Contributors
- Todd Koym, 2016/07/21 - Todd Koym, 2016/07/21
- Jim Fulton, 2017/04/13 - Jim Fulton, 2017/04/13
- Kirill Smelkov, 2017/10/17 - Kirill Smelkov, 2017/10/17
- Éloi Rivard, 2019/01/18
[tox] [tox]
envlist = envlist =
py27,py34,py35,py36,py37,cover,docs {py27,py34,py35,py36}-{zodb4,zodb5},py37-zodb5,cover,docs
[testenv] [testenv]
commands = commands =
python setup.py -q test -q python setup.py -q test -q
deps = deps =
mock mock
zodb4: ZODB==4.*
zodb5: ZODB==5.*
zodb4: ZEO==4.*
zodb5: ZEO==5.*
[testenv:cover] [testenv:cover]
basepython = basepython =
......
import mock import mock
import pkg_resources
import unittest import unittest
ZODB_VERSION = tuple(map(int, pkg_resources.get_distribution("ZODB").version.split('.')))
class Base: class Base:
def test_interpret_kwargs_noargs(self): def test_interpret_kwargs_noargs(self):
...@@ -437,6 +442,16 @@ class TestZConfigURIResolver(unittest.TestCase): ...@@ -437,6 +442,16 @@ class TestZConfigURIResolver(unittest.TestCase):
storage = factory() storage = factory()
from ZODB.MappingStorage import MappingStorage from ZODB.MappingStorage import MappingStorage
self.assertTrue(isinstance(storage, MappingStorage)) self.assertTrue(isinstance(storage, MappingStorage))
if ZODB_VERSION[0] < 5:
self.assertEqual(dbkw,
{'connection_cache_size': 5000,
'connection_cache_size_bytes': 0,
'connection_historical_cache_size': 1000,
'connection_historical_cache_size_bytes': 0,
'connection_historical_pool_size': 3,
'connection_historical_timeout': 300,
'connection_pool_size': 7})
else:
self.assertEqual(dbkw, self.assertEqual(dbkw,
{'connection_cache_size': 5000, {'connection_cache_size': 5000,
'connection_cache_size_bytes': 0, 'connection_cache_size_bytes': 0,
...@@ -447,6 +462,7 @@ class TestZConfigURIResolver(unittest.TestCase): ...@@ -447,6 +462,7 @@ class TestZConfigURIResolver(unittest.TestCase):
'connection_large_record_size': 16777216, 'connection_large_record_size': 16777216,
'connection_pool_size': 7}) 'connection_pool_size': 7})
def test_named_database(self): def test_named_database(self):
self.tmp.write(b""" self.tmp.write(b"""
<zodb x> <zodb x>
...@@ -463,6 +479,17 @@ class TestZConfigURIResolver(unittest.TestCase): ...@@ -463,6 +479,17 @@ class TestZConfigURIResolver(unittest.TestCase):
storage = factory() storage = factory()
from ZODB.MappingStorage import MappingStorage from ZODB.MappingStorage import MappingStorage
self.assertTrue(isinstance(storage, MappingStorage)) self.assertTrue(isinstance(storage, MappingStorage))
if ZODB_VERSION[0] < 5:
self.assertEqual(dbkw,
{'connection_cache_size': 20000,
'connection_cache_size_bytes': 0,
'connection_historical_cache_size': 1000,
'connection_historical_cache_size_bytes': 0,
'connection_historical_pool_size': 3,
'connection_historical_timeout': 300,
'connection_pool_size': 5,
'database_name': 'foo'})
else:
self.assertEqual(dbkw, self.assertEqual(dbkw,
{'connection_cache_size': 20000, {'connection_cache_size': 20000,
'connection_cache_size_bytes': 0, 'connection_cache_size_bytes': 0,
...@@ -474,6 +501,7 @@ class TestZConfigURIResolver(unittest.TestCase): ...@@ -474,6 +501,7 @@ class TestZConfigURIResolver(unittest.TestCase):
'connection_pool_size': 5, 'connection_pool_size': 5,
'database_name': 'foo'}) 'database_name': 'foo'})
def test_database_all_options(self): def test_database_all_options(self):
from zodburi import connection_parameters, bytes_parameters from zodburi import connection_parameters, bytes_parameters
self.tmp.write((""" self.tmp.write(("""
...@@ -518,6 +546,17 @@ class TestZConfigURIResolver(unittest.TestCase): ...@@ -518,6 +546,17 @@ class TestZConfigURIResolver(unittest.TestCase):
storage = factory() storage = factory()
from ZODB.MappingStorage import MappingStorage from ZODB.MappingStorage import MappingStorage
self.assertTrue(isinstance(storage, MappingStorage)) self.assertTrue(isinstance(storage, MappingStorage))
if ZODB_VERSION[0] < 5:
self.assertEqual(dbkw,
{'cache_size': 5000,
'cache_size_bytes': 0,
'historical_cache_size': 1000,
'historical_cache_size_bytes': 0,
'historical_pool_size': 3,
'historical_timeout': 300,
'pool_size': 7,
'database_name': 'unnamed'})
else:
self.assertEqual(dbkw, self.assertEqual(dbkw,
{'cache_size': 5000, {'cache_size': 5000,
'cache_size_bytes': 0, 'cache_size_bytes': 0,
...@@ -529,6 +568,7 @@ class TestZConfigURIResolver(unittest.TestCase): ...@@ -529,6 +568,7 @@ class TestZConfigURIResolver(unittest.TestCase):
'pool_size': 7, 'pool_size': 7,
'database_name': 'unnamed'}) 'database_name': 'unnamed'})
class TestMappingStorageURIResolver(Base, unittest.TestCase): class TestMappingStorageURIResolver(Base, unittest.TestCase):
def _getTargetClass(self): def _getTargetClass(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment