make functional tests run on python 3
- This change updates sanitize_log_path to use replace instead of string.translate so that it works across both python 2.7 and python 3. - This change modifies the functional tests to run under python 3 by default. A new functional-py27 env is also added. Change-Id: Id8127ae68cb5aeebdba73bd14fc0481cd9b773d9
This commit is contained in:
parent
871590f626
commit
5ab2ee6ed0
@ -18,7 +18,6 @@ import functools
|
||||
import inspect
|
||||
import os
|
||||
import six
|
||||
import string
|
||||
import sys
|
||||
|
||||
import eventlet.timeout
|
||||
@ -74,8 +73,7 @@ def setup_logging():
|
||||
|
||||
def sanitize_log_path(path):
|
||||
"""Sanitize the string so that its log path is shell friendly"""
|
||||
replace_map = string.maketrans(' ()', '-__')
|
||||
return path.translate(replace_map)
|
||||
return path.replace(' ', '-').replace('(', '_').replace(')', '_')
|
||||
|
||||
|
||||
# Test worker cannot survive eventlet's Timeout exception, which effectively
|
||||
|
16
tox.ini
16
tox.ini
@ -1,9 +1,10 @@
|
||||
[tox]
|
||||
minversion = 2.0
|
||||
minversion = 3.1.1
|
||||
envlist = py37,py27,pep8
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
basepython = python3
|
||||
usedevelop = True
|
||||
install_command = pip install -U {opts} {packages}
|
||||
setenv =
|
||||
@ -17,11 +18,9 @@ whitelist_externals = bash
|
||||
commands = stestr run --black-regex ".tests.functional" {posargs}
|
||||
|
||||
[testenv:pep8]
|
||||
basepython = python3
|
||||
commands = flake8
|
||||
|
||||
[testenv:venv]
|
||||
basepython = python3
|
||||
commands = {posargs}
|
||||
deps =
|
||||
{env:CONSTRAINTS_OPT}
|
||||
@ -29,29 +28,32 @@ deps =
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
-r{toxinidir}/doc/requirements.txt
|
||||
|
||||
[testenv:functional]
|
||||
[testenv:functional-py27]
|
||||
basepython = python2.7
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
commands =
|
||||
stestr run --black-regex ".tests.unit" '{posargs}'
|
||||
|
||||
[testenv:functional]
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
commands =
|
||||
stestr run --black-regex ".tests.unit" '{posargs}'
|
||||
|
||||
[testenv:docs]
|
||||
basepython = python3
|
||||
deps =
|
||||
{env:CONSTRAINTS_OPT}
|
||||
-r{toxinidir}/doc/requirements.txt
|
||||
commands = sphinx-build -W -b html doc/source doc/build/html
|
||||
|
||||
[testenv:releasenotes]
|
||||
basepython = python3
|
||||
deps =
|
||||
{env:CONSTRAINTS_OPT}
|
||||
-r{toxinidir}/doc/requirements.txt
|
||||
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
||||
|
||||
[testenv:lower-constraints]
|
||||
basepython = python3
|
||||
deps =
|
||||
-c{toxinidir}/lower-constraints.txt
|
||||
-r{toxinidir}/requirements.txt
|
||||
|
Loading…
Reference in New Issue
Block a user