Initial commit that fix py34 tests run
Partial-Bug: #1378537 Change-Id: Ib32b66e8e9771bbc9957a4f2489d528aeb3d40d5
This commit is contained in:
parent
f42b7f5f5e
commit
e882a4f16d
@ -14,6 +14,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_db import options
|
from oslo_db import options
|
||||||
from oslo_db.sqlalchemy import session as db_session
|
from oslo_db.sqlalchemy import session as db_session
|
||||||
@ -42,7 +44,7 @@ def _get_facade():
|
|||||||
cfg.CONF.database.connection,
|
cfg.CONF.database.connection,
|
||||||
sqlite_fk=True,
|
sqlite_fk=True,
|
||||||
autocommit=False,
|
autocommit=False,
|
||||||
**dict(cfg.CONF.database.iteritems())
|
**dict(six.iteritems(cfg.CONF.database))
|
||||||
)
|
)
|
||||||
|
|
||||||
return _facade
|
return _facade
|
||||||
|
@ -38,6 +38,8 @@ class _MistralModelBase(oslo_models.ModelBase, oslo_models.TimestampMixin):
|
|||||||
|
|
||||||
__table__ = None
|
__table__ = None
|
||||||
|
|
||||||
|
__hash__ = object.__hash__
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
for key, value in kwargs.items():
|
for key, value in kwargs.items():
|
||||||
setattr(self, key, value)
|
setattr(self, key, value)
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
# Copyright 2015 - Mirantis, Inc.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
import eventlet
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
eventlet.monkey_patch(
|
|
||||||
os=True,
|
|
||||||
select=True,
|
|
||||||
socket=True,
|
|
||||||
thread=False if '--use-debugger' in sys.argv else True,
|
|
||||||
time=True
|
|
||||||
)
|
|
@ -127,7 +127,7 @@ class BaseTest(base.BaseTestCase):
|
|||||||
|
|
||||||
filtered_items = filter(lambda item: _matches(item, **props), items)
|
filtered_items = filter(lambda item: _matches(item, **props), items)
|
||||||
|
|
||||||
found = len(filtered_items)
|
found = len(list(filtered_items))
|
||||||
|
|
||||||
if found != count:
|
if found != count:
|
||||||
LOG.info("[failed test ctx] items=%s, expected_props=%s" % (str(
|
LOG.info("[failed test ctx] items=%s, expected_props=%s" % (str(
|
||||||
|
@ -19,6 +19,7 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from os import path
|
from os import path
|
||||||
|
import six
|
||||||
import socket
|
import socket
|
||||||
import threading
|
import threading
|
||||||
import uuid
|
import uuid
|
||||||
@ -37,7 +38,7 @@ _th_loc_storage = threading.local()
|
|||||||
|
|
||||||
|
|
||||||
def generate_unicode_uuid():
|
def generate_unicode_uuid():
|
||||||
return unicode(str(uuid.uuid4()))
|
return six.text_type(str(uuid.uuid4()))
|
||||||
|
|
||||||
|
|
||||||
def _get_greenlet_local_storage():
|
def _get_greenlet_local_storage():
|
||||||
@ -127,7 +128,7 @@ def merge_dicts(left, right, overwrite=True):
|
|||||||
if right is None:
|
if right is None:
|
||||||
return left
|
return left
|
||||||
|
|
||||||
for k, v in right.iteritems():
|
for k, v in six.iteritems(right):
|
||||||
if k not in left:
|
if k not in left:
|
||||||
left[k] = v
|
left[k] = v
|
||||||
else:
|
else:
|
||||||
|
@ -320,7 +320,7 @@ class BaseListSpec(BaseSpec):
|
|||||||
|
|
||||||
self.items = []
|
self.items = []
|
||||||
|
|
||||||
for k, v in data.iteritems():
|
for k, v in six.iteritems(data):
|
||||||
if k != 'version':
|
if k != 'version':
|
||||||
v['name'] = k
|
v['name'] = k
|
||||||
self._inject_version([k])
|
self._inject_version([k])
|
||||||
@ -353,7 +353,7 @@ class BaseSpecList(object):
|
|||||||
def __init__(self, data):
|
def __init__(self, data):
|
||||||
self.items = {}
|
self.items = {}
|
||||||
|
|
||||||
for k, v in data.iteritems():
|
for k, v in six.iteritems(data):
|
||||||
if k != 'version':
|
if k != 'version':
|
||||||
v['name'] = k
|
v['name'] = k
|
||||||
v['version'] = self._version
|
v['version'] = self._version
|
||||||
@ -363,7 +363,7 @@ class BaseSpecList(object):
|
|||||||
return self.items.keys()
|
return self.items.keys()
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return self.items.itervalues()
|
return six.itervalues(self.items)
|
||||||
|
|
||||||
def __getitem__(self, name):
|
def __getitem__(self, name):
|
||||||
return self.items.get(name)
|
return self.items.get(name)
|
||||||
|
2
tox.ini
2
tox.ini
@ -11,7 +11,7 @@ setenv = VIRTUAL_ENV={envdir}
|
|||||||
PYTHONDONTWRITEBYTECODE = 1
|
PYTHONDONTWRITEBYTECODE = 1
|
||||||
deps = -r{toxinidir}/test-requirements.txt
|
deps = -r{toxinidir}/test-requirements.txt
|
||||||
commands =
|
commands =
|
||||||
python setup.py test --slowest --testr-args='{posargs}'
|
python setup.py testr --slowest --testr-args='{posargs}'
|
||||||
whitelist_externals = rm
|
whitelist_externals = rm
|
||||||
|
|
||||||
[testenv:unit-postgresql]
|
[testenv:unit-postgresql]
|
||||||
|
Loading…
Reference in New Issue
Block a user