Stop using nose as a Python3 test runner

There are several reasons for this change:
- removes the need for the custome py3 test dependencies
- makes the broken tests more visible because they are listed
  instead of the working ones
- using a blacklist means that new test files are tested by default in
  py3

bp python3

Change-Id: I7472eec05d80cdd99c0ee376159578e0d7306f51
changes/54/278054/5
David Stanek 7 years ago committed by Steve Martinelli
parent 7a60566c7d
commit 8f15724dc7
  1. 19
      keystone/tests/unit/__init__.py
  2. 1
      test-requirements.txt
  3. 27
      tests-py3-blacklist.txt
  4. 12
      tools/pretty_tox_py3.sh
  5. 53
      tox.ini

@ -13,6 +13,25 @@
# under the License.
import oslo_i18n
import six
if six.PY3:
# NOTE(dstanek): This block will monkey patch libraries that are not
# yet supported in Python3. We do this that that it is possible to
# execute any tests at all. Without monkey patching modules the
# tests will fail with import errors.
import sys
from unittest import mock # noqa: our import detection is naive?
sys.modules['ldap'] = mock.Mock()
sys.modules['ldap.controls'] = mock.Mock()
sys.modules['ldap.dn'] = mock.Mock()
sys.modules['ldap.filter'] = mock.Mock()
sys.modules['ldap.modlist'] = mock.Mock()
sys.modules['ldappool'] = mock.Mock()
# NOTE(dstanek): oslo_i18n.enable_lazy() must be called before
# keystone.i18n._() is called to ensure it has the desired lazy lookup

@ -6,6 +6,7 @@ hacking<0.11,>=0.10.0
pep257==0.7.0 # MIT License
flake8-docstrings==0.2.1.post1 # MIT
bashate>=0.2 # Apache-2.0
os-testr>=0.4.1 # Apache-2.0
# computes code coverage percentages
coverage>=3.6 # Apache-2.0

@ -0,0 +1,27 @@
keystone.tests.unit.common.test_ldap
keystone.tests.unit.common.test_notifications
keystone.tests.unit.test_associate_project_endpoint_extension
keystone.tests.unit.test_backend_ldap
keystone.tests.unit.test_backend_ldap_pool
keystone.tests.unit.test_backend_templated
keystone.tests.unit.test_cert_setup
keystone.tests.unit.test_contrib_simple_cert
keystone.tests.unit.test_hacking_checks
keystone.tests.unit.test_ipv6
keystone.tests.unit.test_v2
keystone.tests.unit.test_v3
keystone.tests.unit.test_v3_assignment
keystone.tests.unit.test_v3_auth
keystone.tests.unit.test_v3_credential
keystone.tests.unit.test_v3_domain_config
keystone.tests.unit.test_v3_endpoint_policy
keystone.tests.unit.test_v3_federation
keystone.tests.unit.test_v3_identity
keystone.tests.unit.test_v3_oauth1
keystone.tests.unit.test_v3_os_revoke
keystone.tests.unit.test_v3_protection
keystone.tests.unit.test_v3_resource
keystone.tests.unit.test_v3_trust
keystone.tests.unit.test_versions
keystone.tests.unit.token.test_fernet_provider
keystone.tests.unit.token.test_token_data_helper

@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -o pipefail
TESTRARGS=`python -c 'print ("^((?!%s).)*$" % "|".join(f.strip() for f in open("tests-py3-blacklist.txt")))'`
python setup.py testr --testr-args="--subunit $TESTRARGS" | subunit-trace -f
retval=$?
# NOTE(mtreinish) The pipe above would eat the slowest display from pbr's testr
# wrapper so just manually print the slowest tests.
echo -e "\nSlowest Tests:\n"
testr slowest
exit $retval

@ -14,58 +14,7 @@ whitelist_externals = bash
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY PBR_VERSION
[testenv:py34]
deps = -r{toxinidir}/test-requirements.txt
nose
.[memcache,mongodb]
commands =
nosetests --with-coverage --cover-package=keystone \
keystone/tests/unit/auth/ \
keystone/tests/unit/backend/core_sql.py \
keystone/tests/unit/backend/domain_config/ \
keystone/tests/unit/backend/role/test_sql.py \
keystone/tests/unit/catalog/ \
keystone/tests/unit/common/test_authorization.py \
keystone/tests/unit/common/test_injection.py \
keystone/tests/unit/common/test_json_home.py \
keystone/tests/unit/common/test_manager.py \
keystone/tests/unit/common/test_sql_core.py \
keystone/tests/unit/common/test_utils.py \
keystone/tests/unit/contrib/ \
keystone/tests/unit/external/ \
keystone/tests/unit/test_auth_plugin.py \
keystone/tests/unit/test_backend_endpoint_policy.py \
keystone/tests/unit/test_backend_endpoint_policy_sql.py \
keystone/tests/unit/test_backend_federation_sql.py \
keystone/tests/unit/test_backend_id_mapping_sql.py \
keystone/tests/unit/test_backend.py \
keystone/tests/unit/test_backend_rules.py \
keystone/tests/unit/test_backend_sql.py \
keystone/tests/unit/test_cli.py \
keystone/tests/unit/test_config.py \
keystone/tests/unit/test_contrib_s3_core.py \
keystone/tests/unit/test_credential.py \
keystone/tests/unit/test_driver_hints.py \
keystone/tests/unit/test_exception.py \
keystone/tests/unit/test_kvs.py \
keystone/tests/unit/test_middleware.py \
keystone/tests/unit/test_no_admin_token_auth.py \
keystone/tests/unit/test_policy.py \
keystone/tests/unit/test_revoke.py \
keystone/tests/unit/test_sql_livetest.py \
keystone/tests/unit/test_sql_upgrade.py \
keystone/tests/unit/test_ssl.py \
keystone/tests/unit/test_token_bind.py \
keystone/tests/unit/test_token_provider.py \
keystone/tests/unit/test_url_middleware.py \
keystone/tests/unit/test_v2_controller.py \
keystone/tests/unit/test_validation.py \
keystone/tests/unit/test_wsgi.py \
keystone/tests/unit/tests/ \
keystone/tests/unit/token/test_pki_provider.py \
keystone/tests/unit/token/test_pkiz_provider.py \
keystone/tests/unit/token/test_provider.py \
keystone/tests/unit/token/test_token_model.py \
keystone/tests/unit/token/test_uuid_provider.py
commands = bash tools/pretty_tox_py3.sh
[testenv:legacy_drivers]
deps = -r{toxinidir}/test-requirements.txt

Loading…
Cancel
Save