Add py33 target into tox.ini

Enable tests that could be imported into py33 environment.

Part of blueprint bp/py33

Change-Id: I097e406cda3b86ad75e6f2f780b9a700b4fe42ef
This commit is contained in:
Ilya Shakhat 2014-06-27 14:00:53 +04:00
parent d6b37e6bc8
commit 38d31a0c2d
4 changed files with 30 additions and 9 deletions

11
requirements-py3.txt Normal file
View File

@ -0,0 +1,11 @@
Babel>=1.3
Flask>=0.10,<1.0
iso8601>=0.1.8
oslo.config>=1.2.0
paramiko>=1.8.0
pbr>=0.6,<1.0
psutil>=1.1.1
python3-memcached>=1.48
PyYAML>=3.1.0
sh
six>=1.5.2

View File

@ -108,10 +108,10 @@ def read_json_from_uri(uri):
def make_range(start, stop, step):
last_full = stop - ((stop - start) % step)
for i in xrange(start, last_full, step):
yield xrange(i, i + step)
for i in six.moves.xrange(start, last_full, step):
yield six.moves.xrange(i, i + step)
if stop > last_full:
yield xrange(last_full, stop)
yield six.moves.xrange(last_full, stop)
def store_user(runtime_storage_inst, user):

View File

@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import itertools
import time
import mock
@ -1070,17 +1069,17 @@ class TestRecordProcessor(testtools.TestCase):
marks = list([r for r in runtime_storage_inst.get_all_records()
if r['record_type'] == 'mark'])
homer_mark = next(itertools.ifilter(
homer_mark = next(six.moves.filter(
lambda x: x['date'] == (timestamp - 1), marks), None)
self.assertTrue(homer_mark.get('disagreement'),
msg='Disagreement: core set -2 after +2')
homer_mark = next(itertools.ifilter(
homer_mark = next(six.moves.filter(
lambda x: x['date'] == (timestamp + 2), marks), None)
self.assertFalse(homer_mark.get('disagreement'),
msg='No disagreement: core set +2 after +1')
bart_mark = next(itertools.ifilter(
bart_mark = next(six.moves.filter(
lambda x: x['date'] == (timestamp + 3), marks), None)
self.assertTrue(bart_mark.get('disagreement'),
msg='Disagreement: core set +2 after -1')
@ -1416,7 +1415,8 @@ def make_runtime_storage(users=None, companies=None, releases=None,
return count
def get_all_users():
for n in xrange(0, (runtime_storage_cache.get('user:count') or 0) + 1):
for n in six.moves.xrange(
0, (runtime_storage_cache.get('user:count') or 0) + 1):
u = runtime_storage_cache.get('user:%s' % n)
if u:
yield u

12
tox.ini
View File

@ -1,5 +1,5 @@
[tox]
envlist = py26,py27,pep8
envlist = py26,py27,py33,pep8
minversion = 1.6
skipsdist = True
@ -15,6 +15,16 @@ deps = -r{toxinidir}/requirements.txt
commands = python setup.py testr --testr-args='{posargs}'
distribute = false
[testenv:py33]
basepython = python3
deps = -r{toxinidir}/requirements-py3.txt
-r{toxinidir}/test-requirements.txt
# to be removed once all tests passed
commands = python -m testtools.run \
tests.unit.test_utils \
tests.unit.test_mps \
tests.unit.test_record_processor
[testenv:pep8]
commands = flake8
{toxinidir}/tools/requirements_style_check.sh requirements.txt test-requirements.txt