Commit 4175652e authored by Tres Seaver's avatar Tres Seaver Committed by GitHub

Merge pull request #24 from azmeuk/tox-zodb4

Add tests for zodb4.
parents 475f420d 7502fa4f
......@@ -5,19 +5,27 @@ sudo: false
matrix:
include:
- 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
env: TOXENV=py34
env: TOXENV=py34-zodb5
- 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
env: TOXENV=py36
env: TOXENV=py36-zodb5
- python: 3.7
env: TOXENV=py37
env: TOXENV=py37-zodb5
dist: xenial
sudo: true
- python: 3.8-dev
env: TOXENV=py38
env: TOXENV=py38-zodb5
dist: xenial
sudo: true
allow_failures:
......
......@@ -103,3 +103,4 @@ Contributors
- Todd Koym, 2016/07/21
- Jim Fulton, 2017/04/13
- Kirill Smelkov, 2017/10/17
- Éloi Rivard, 2019/01/18
[tox]
envlist =
py27,py34,py35,py36,py37,cover,docs
{py27,py34,py35,py36}-{zodb4,zodb5},py37-zodb5,cover,docs
[testenv]
commands =
python setup.py -q test -q
deps =
mock
zodb4: ZODB==4.*
zodb5: ZODB==5.*
zodb4: ZEO==4.*
zodb5: ZEO==5.*
[testenv:cover]
basepython =
......
import mock
import pkg_resources
import unittest
ZODB_VERSION = tuple(map(int, pkg_resources.get_distribution("ZODB").version.split('.')))
class Base:
def test_interpret_kwargs_noargs(self):
......@@ -437,15 +442,26 @@ class TestZConfigURIResolver(unittest.TestCase):
storage = factory()
from ZODB.MappingStorage import MappingStorage
self.assertTrue(isinstance(storage, MappingStorage))
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_large_record_size': 16777216,
'connection_pool_size': 7})
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,
{'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_large_record_size': 16777216,
'connection_pool_size': 7})
def test_named_database(self):
self.tmp.write(b"""
......@@ -463,16 +479,28 @@ class TestZConfigURIResolver(unittest.TestCase):
storage = factory()
from ZODB.MappingStorage import MappingStorage
self.assertTrue(isinstance(storage, MappingStorage))
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_large_record_size': 16777216,
'connection_pool_size': 5,
'database_name': 'foo'})
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,
{'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_large_record_size': 16777216,
'connection_pool_size': 5,
'database_name': 'foo'})
def test_database_all_options(self):
from zodburi import connection_parameters, bytes_parameters
......@@ -518,16 +546,28 @@ class TestZConfigURIResolver(unittest.TestCase):
storage = factory()
from ZODB.MappingStorage import MappingStorage
self.assertTrue(isinstance(storage, MappingStorage))
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,
'large_record_size': 16777216,
'pool_size': 7,
'database_name': 'unnamed'})
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,
{'cache_size': 5000,
'cache_size_bytes': 0,
'historical_cache_size': 1000,
'historical_cache_size_bytes': 0,
'historical_pool_size': 3,
'historical_timeout': 300,
'large_record_size': 16777216,
'pool_size': 7,
'database_name': 'unnamed'})
class TestMappingStorageURIResolver(Base, unittest.TestCase):
......
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