From 3b7ed9d286d94235d55e8c2bb647bcbbef73bb6d Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 22 May 2015 10:17:27 -0700 Subject: [PATCH] Run tests with PyMySQL on Python 3 Add test-requirements-py3.txt to use PyMySQL, instead of MySQL-python, on Python 3. Add a py34 test environment to tox.ini which uses test-requirements-py3.txt and sets OS_TEST_DBAPI_ADMIN_CONNECTION to use the PyMySQL connector instead of the MySQL-python connector. This change is based on Ironic tox.ini, so I added Victor Sergeyev as the coauthor of the patch. Co-Authored-By: Victor Sergeyev Blueprint nova-python3 Change-Id: I5a27c7d627105b614da3cab3a87296a8e186b555 --- test-requirements-py3.txt | 25 +++++++++++++++++++++++++ tox.ini | 14 +++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 test-requirements-py3.txt diff --git a/test-requirements-py3.txt b/test-requirements-py3.txt new file mode 100644 index 000000000000..c432713a7696 --- /dev/null +++ b/test-requirements-py3.txt @@ -0,0 +1,25 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. + +hacking>=0.10.0,<0.11 +coverage>=3.6 +discover +fixtures>=0.3.14 +mock>=1.0 +mox3>=0.7.0 +PyMySQL>=0.6.2 # MIT License +psycopg2 +python-barbicanclient>=3.0.1 +python-ironicclient>=0.2.1 +python-subunit>=0.0.18 +requests-mock>=0.6.0 # Apache-2.0 +sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3 +oslosphinx>=2.5.0 # Apache-2.0 +oslotest>=1.5.1 # Apache-2.0 +testrepository>=0.0.18 +testtools>=0.9.36,!=1.2.0 +tempest-lib>=0.5.0 + +# vmwareapi driver specific dependencies +oslo.vmware>=0.11.1 # Apache-2.0 diff --git a/tox.ini b/tox.ini index c2b9577172e8..804b959fd4d7 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 1.6 -envlist = py27,functional,pep8,pip-missing-reqs +envlist = py34,py27,functional,pep8,pip-missing-reqs skipsdist = True [testenv] @@ -29,6 +29,18 @@ downloadcache = ~/cache/pip commands = flake8 {posargs} +[testenv:py34] +# NOTE(viktors): we must change default connection string for MySQL because +# we use a different DB connector (PyMySQL, not MySQLdb) in py3x +# env. So we should put new DB URLs in the env variable. This +# will allow to run tests, that require MySQL database, +# for example DB migration tests. +setenv = + {[testenv]setenv} + OS_TEST_DBAPI_ADMIN_CONNECTION=mysql+pymysql://openstack_citest:openstack_citest@localhost/;postgresql://openstack_citest:openstack_citest@localhost/postgres;sqlite:// +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements-py3.txt + [testenv:functional] usedevelop = True install_command = pip install -U --force-reinstall {opts} {packages}