Ver código fonte

Switching Poppy test to use ostestr (OpenStack Testr)

Change-Id: Iec921d21f3325e92462c7a2b40d748db8f85cdff
tags/1.0.13
tonytan4ever 3 anos atrás
pai
commit
2140f6def0

+ 1
- 1
.testr.conf Ver arquivo

@@ -2,7 +2,7 @@
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./tests} $LISTOPT $IDOPTION
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./tests/unit} $LISTOPT $IDOPTION

test_id_option=--load-list $IDFILE
test_list_option=--list

+ 2
- 0
poppy/provider/maxcdn/services.py Ver arquivo

@@ -129,6 +129,8 @@ class ServiceController(base.ServiceBase):
Map a poppy service name to a provider's service name so it
can comply provider's naming convention.
"""
if isinstance(service_name, bytes):
service_name = service_name.decode("utf-8")
if MAXCDN_NAMING_REGEX.match(service_name):
return service_name
else:

+ 0
- 11
setup.cfg Ver arquivo

@@ -76,17 +76,6 @@ poppy.provider.akamai.cert_info_storage =
[wheel]
universal = 1

[nosetests]
cover-branches = true
cover-erase = true
cover-inclusive = true
#cover-min-percentage = 100
cover-package = poppy
#match = ^test
where = tests
with-coverage = true
verbosity=2

; Disabled: Causes a bug in testtools to manifest.
; Trigger: self.assertX(condition), where condition == False.
;

+ 1
- 1
tests/test-requirements.txt Ver arquivo

@@ -4,9 +4,9 @@ dnspython
fixtures
hacking
mock
nose
openstack.nose_plugin
oslotest>=1.9.0
os-testr>=0.7.0 # Apache-2.0
requests-mock
testrepository
testtools

+ 2
- 0
tests/unit/distributed_task/taskflow/test_flows.py Ver arquivo

@@ -312,6 +312,8 @@ class TestFlowRuns(base.TestCase):

self.patch_delete_flow(service_controller, storage_controller,
dns_controller)
storage_controller.get_service = mock.Mock(
return_value=service_obj)
engines.run(delete_service.delete_service(), store=kwargs)

def test_purge_flow_normal(self):

+ 4
- 0
tests/unit/manager/default/test_flavors.py Ver arquivo

@@ -19,6 +19,7 @@ import uuid
import mock
from oslo_config import cfg

from poppy import bootstrap
from poppy.manager.default import driver
from poppy.manager.default import flavors
from poppy.model import flavor
@@ -42,6 +43,9 @@ class DefaultManagerFlavorTests(base.TestCase):
os.path.dirname(os.path.dirname(__file__)))))
conf_path = os.path.join(tests_path, 'etc', 'default_functional.conf')
cfg.CONF(args=[], default_config_files=[conf_path])
cfg.CONF.register_opts(bootstrap._DEFAULT_OPTIONS)
cfg.CONF.register_opts(bootstrap._DRIVER_OPTIONS,
group=bootstrap._DRIVER_GROUP)

manager_driver = driver.DefaultManagerDriver(cfg.CONF,
mock_driver,

+ 2
- 2
tests/unit/model/helpers/test_domain.py Ver arquivo

@@ -27,8 +27,8 @@ class TestDomain(base.TestCase):
@ddt.unpack
@ddt.data({'domain_name': 'www.mydomain.com',
'changed_domain_name': 'www.changed-domain.com'},
{'domain_name': u'www.düsseldorf-Lörick.com',
'changed_domain_name': u'www.düsseldorf.com'
{'domain_name': u'www.düsseldorf-Lörick.com'.encode("utf-8"),
'changed_domain_name': u'www.düsseldorf.com'.encode("utf-8")
},
{'domain_name': u'WWW.UPPERCASE.COM',
'changed_domain_name': u'WWW.UPPERCASE-CHANGED.COM'

+ 2
- 2
tests/unit/model/helpers/test_origin.py Ver arquivo

@@ -27,8 +27,8 @@ class TestOrigin(base.TestCase):
@ddt.unpack
@ddt.data({'origin_url': 'www.mydomain.com',
'changed_origin_url': 'www.changed-domain.com'},
{'origin_url': u'www.düsseldorf-Lörick.com',
'changed_origin_url': u'www.düsseldorf.com'})
{'origin_url': u'www.düsseldorf-Lörick.com'.encode("utf-8"),
'changed_origin_url': u'www.düsseldorf.com'.encode("utf-8")})
def test_origin(self, origin_url, changed_origin_url):

port = 80

+ 2
- 1
tests/unit/provider/maxcdn/test_services.py Ver arquivo

@@ -289,7 +289,8 @@ class TestServices(base.TestCase):
self.assertEqual(controller._map_service_name(service_name),
service_name)

@ddt.data(u'www.düsseldorf-Lörick.com', 'yahoo%_notvalid')
@ddt.data(u'www.düsseldorf-Lörick.com'.encode("utf-8"),
'yahoo%_notvalid')
@mock.patch.object(driver.CDNProvider, 'client',
new=fake_maxcdn_api_client())
def test_map_service_name_with_hash(self, service_name):

+ 2
- 1
tests/unit/provider/mock/test_services.py Ver arquivo

@@ -74,7 +74,8 @@ class MockProviderServicesTest(base.TestCase):
response = self.sc.create(service_obj)
self.assertTrue(response is not None)

@ddt.data("my_mock_service.com", u'www.düsseldorf-Lörick.com')
@ddt.data("my_mock_service.com",
u'www.düsseldorf-Lörick.com'.encode('utf-8'))
def test__map_service_name(self, service_name):
self.assertTrue(self.sc._map_service_name(service_name),
service_name)

+ 0
- 0
tests/unit/provider/sample/__init__.py Ver arquivo


+ 8
- 0
tools/ostestr_compat_shim.sh Ver arquivo

@@ -0,0 +1,8 @@
#!/bin/sh

# preserve old behavior of using an arg as a regex when '--' is not present
case $@ in
(*--*) ostestr $@;;
('') ostestr;;
(*) ostestr --regex "$@"
esac

+ 32
- 19
tox.ini Ver arquivo

@@ -1,25 +1,38 @@
[tox]
minversion = 1.6
envlist = py34,py27,pypy,pep8
envlist = py34,py27,functional,functional-py34,pypy,pep8
skipsdist = True

[testenv]
usedevelop = True
# Customize pip command, add -U to force updates.
install_command = pip install -U {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
LC_ALL = en_US.UTF-8
NOSE_WITH_OPENSTACK=1
NOSE_OPENSTACK_COLOR=1
NOSE_OPENSTACK_RED=0.05
NOSE_OPENSTACK_YELLOW=0.025
NOSE_OPENSTACK_SHOW_ELAPSED=1
NOSE_OPENSTACK_STDOUT=1
PYTHONDONTWRITEBYTECODE=1
install_command = pip install -U {opts} {packages}
passenv = TRACE_FAILONLY GENERATE_HASHES http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
deps = -r{toxinidir}/requirements/requirements.txt
-r{toxinidir}/tests/test-requirements.txt
commands = pip install git+https://github.com/stackforge/opencafe.git#egg=cafe
nosetests unit functional {posargs:--nologcapture}
{toxinidir}/tools/ostestr_compat_shim.sh {posargs}

[testenv:common]
# Fake job to define environment variables shared between dsvm/non-dsvm jobs
setenv = OS_TEST_TIMEOUT=180

[testenv:functional]
basepython = python2.7
setenv = {[testenv]setenv}
{[testenv:common]setenv}
OS_TEST_PATH=./tests/functional
OS_LOG_PATH={env:OS_LOG_PATH:{homedir}/.poppy/logs}
deps =
{[testenv]deps}

[testenv:functional-py34]
basepython = python3.4
setenv = {[testenv:functional]setenv}
deps =
{[testenv:functional]deps}

[testenv:pep8]
commands = flake8
@@ -47,7 +60,11 @@ commands =
python setup.py build_sphinx -E -a -b coverage

[testenv:cover]
setenv = NOSE_WITH_COVERAGE=1
install_command = pip install -U {opts} {packages}
basepython = python2.7
commands =
python setup.py testr --coverage --testr-args='{posargs}'
coverage report

[testenv:venv]
commands = {posargs}
@@ -66,15 +83,11 @@ setenv = CAFE_CONFIG_FILE_PATH={homedir}/.poppy/tests.conf
CAFE_ROOT_LOG_PATH={homedir}/.poppy/logs
CAFE_TEST_LOG_PATH={homedir}/.poppy/logs

NOSE_WITH_OPENSTACK=1
NOSE_OPENSTACK_COLOR=1
NOSE_OPENSTACK_RED=0.05
NOSE_OPENSTACK_YELLOW=0.025
NOSE_OPENSTACK_SHOW_ELAPSED=1
NOSE_OPENSTACK_STDOUT=1
OS_TEST_PATH=./tests/api
OS_LOG_PATH={env:OS_LOG_PATH:{homedir}/.poppy/logs}

commands =
pip install git+https://github.com/openstack/opencafe.git#egg=cafe
./run_poppy.sh -d
#./run_poppy.sh -d

nosetests api --nologcapture
{toxinidir}/tools/ostestr_compat_shim.sh

Carregando…
Cancelar
Salvar