Initial commit that fix py34 tests run

Partial-Bug: #1378537

Change-Id: Ib32b66e8e9771bbc9957a4f2489d528aeb3d40d5
This commit is contained in:
Anastasia Kuznetsova 2015-09-09 12:23:43 +03:00
parent f42b7f5f5e
commit e882a4f16d
7 changed files with 13 additions and 33 deletions

View File

@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import six
from oslo_config import cfg
from oslo_db import options
from oslo_db.sqlalchemy import session as db_session
@ -42,7 +44,7 @@ def _get_facade():
cfg.CONF.database.connection,
sqlite_fk=True,
autocommit=False,
**dict(cfg.CONF.database.iteritems())
**dict(six.iteritems(cfg.CONF.database))
)
return _facade

View File

@ -38,6 +38,8 @@ class _MistralModelBase(oslo_models.ModelBase, oslo_models.TimestampMixin):
__table__ = None
__hash__ = object.__hash__
def __init__(self, **kwargs):
for key, value in kwargs.items():
setattr(self, key, value)

View File

@ -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
)

View File

@ -127,7 +127,7 @@ class BaseTest(base.BaseTestCase):
filtered_items = filter(lambda item: _matches(item, **props), items)
found = len(filtered_items)
found = len(list(filtered_items))
if found != count:
LOG.info("[failed test ctx] items=%s, expected_props=%s" % (str(

View File

@ -19,6 +19,7 @@ import json
import logging
import os
from os import path
import six
import socket
import threading
import uuid
@ -37,7 +38,7 @@ _th_loc_storage = threading.local()
def generate_unicode_uuid():
return unicode(str(uuid.uuid4()))
return six.text_type(str(uuid.uuid4()))
def _get_greenlet_local_storage():
@ -127,7 +128,7 @@ def merge_dicts(left, right, overwrite=True):
if right is None:
return left
for k, v in right.iteritems():
for k, v in six.iteritems(right):
if k not in left:
left[k] = v
else:

View File

@ -320,7 +320,7 @@ class BaseListSpec(BaseSpec):
self.items = []
for k, v in data.iteritems():
for k, v in six.iteritems(data):
if k != 'version':
v['name'] = k
self._inject_version([k])
@ -353,7 +353,7 @@ class BaseSpecList(object):
def __init__(self, data):
self.items = {}
for k, v in data.iteritems():
for k, v in six.iteritems(data):
if k != 'version':
v['name'] = k
v['version'] = self._version
@ -363,7 +363,7 @@ class BaseSpecList(object):
return self.items.keys()
def __iter__(self):
return self.items.itervalues()
return six.itervalues(self.items)
def __getitem__(self, name):
return self.items.get(name)

View File

@ -11,7 +11,7 @@ setenv = VIRTUAL_ENV={envdir}
PYTHONDONTWRITEBYTECODE = 1
deps = -r{toxinidir}/test-requirements.txt
commands =
python setup.py test --slowest --testr-args='{posargs}'
python setup.py testr --slowest --testr-args='{posargs}'
whitelist_externals = rm
[testenv:unit-postgresql]