Migrate to testr from nose.
Change-Id: Ibe0c2eeee9aeb4cb1832456cdc0d080a5a9af175
This commit is contained in:
parent
2e6e49f7fa
commit
c4174d39ae
|
@ -17,3 +17,4 @@ doc/source/api
|
|||
heatclient/versioninfo
|
||||
python_heatclient.egg-info
|
||||
*.log
|
||||
.testrepository
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
[DEFAULT]
|
||||
test_command=${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
|
@ -6,6 +6,7 @@ import sys
|
|||
|
||||
import fixtures
|
||||
import mox
|
||||
import testscenarios
|
||||
import testtools
|
||||
try:
|
||||
import json
|
||||
|
@ -18,6 +19,7 @@ from heatclient import exc
|
|||
import heatclient.shell
|
||||
from heatclient.v1 import client as v1client
|
||||
|
||||
load_tests = testscenarios.load_tests_apply_scenarios
|
||||
TEST_VAR_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
||||
'var'))
|
||||
|
||||
|
@ -58,42 +60,32 @@ class TestCase(testtools.TestCase):
|
|||
|
||||
class EnvVarTest(TestCase):
|
||||
|
||||
scenarios = [
|
||||
('username', dict(
|
||||
remove='OS_USERNAME',
|
||||
err='You must provide a username')),
|
||||
('password', dict(
|
||||
remove='OS_PASSWORD',
|
||||
err='You must provide a password')),
|
||||
('tenant_name', dict(
|
||||
remove='OS_TENANT_NAME',
|
||||
err='You must provide a tenant_id')),
|
||||
('auth_url', dict(
|
||||
remove='OS_AUTH_URL',
|
||||
err='You must provide an auth url')),
|
||||
]
|
||||
|
||||
def test_missing_auth(self):
|
||||
fake_env = {
|
||||
'OS_USERNAME': None,
|
||||
'OS_PASSWORD': 'password',
|
||||
'OS_TENANT_NAME': 'tenant_name',
|
||||
'OS_AUTH_URL': 'http://no.where',
|
||||
}
|
||||
self.set_fake_env(fake_env)
|
||||
self.shell_error('list', 'You must provide a username')
|
||||
|
||||
fake_env = {
|
||||
'OS_USERNAME': 'username',
|
||||
'OS_PASSWORD': None,
|
||||
'OS_TENANT_NAME': 'tenant_name',
|
||||
'OS_AUTH_URL': 'http://no.where',
|
||||
}
|
||||
self.set_fake_env(fake_env)
|
||||
self.shell_error('list', 'You must provide a password')
|
||||
|
||||
fake_env = {
|
||||
'OS_USERNAME': 'username',
|
||||
'OS_PASSWORD': 'password',
|
||||
'OS_TENANT_NAME': None,
|
||||
'OS_AUTH_URL': 'http://no.where',
|
||||
}
|
||||
self.set_fake_env(fake_env)
|
||||
self.shell_error('list', 'You must provide a tenant_id')
|
||||
|
||||
fake_env = {
|
||||
'OS_USERNAME': 'username',
|
||||
'OS_PASSWORD': 'password',
|
||||
'OS_TENANT_NAME': 'tenant_name',
|
||||
'OS_AUTH_URL': None,
|
||||
'OS_AUTH_URL': 'http://no.where',
|
||||
}
|
||||
fake_env[self.remove] = None
|
||||
self.set_fake_env(fake_env)
|
||||
self.shell_error('list', 'You must provide an auth url')
|
||||
self.shell_error('list', self.err)
|
||||
|
||||
|
||||
class ShellValidationTest(TestCase):
|
||||
|
|
|
@ -29,13 +29,6 @@ console_scripts =
|
|||
setup-hooks =
|
||||
pbr.hooks.setup_hook
|
||||
|
||||
[nosetests]
|
||||
cover-package = heatclient
|
||||
cover-html = true
|
||||
cover-erase = true
|
||||
cover-inclusive = true
|
||||
verbosity=2
|
||||
|
||||
[build_sphinx]
|
||||
source-dir = doc/source
|
||||
build-dir = doc/build
|
||||
|
|
|
@ -6,12 +6,11 @@ pyflakes==0.7.2
|
|||
flake8==2.0
|
||||
hacking>=0.5.3,<0.6
|
||||
|
||||
coverage>=3.6
|
||||
discover
|
||||
fixtures>=0.3.12
|
||||
mox
|
||||
nose
|
||||
nose-exclude
|
||||
nosexcover
|
||||
openstack.nose_plugin
|
||||
nosehtmloutput
|
||||
sphinx>=1.1.2
|
||||
testscenarios<0.5
|
||||
testrepository>=0.0.13
|
||||
testtools>=0.9.29
|
||||
|
|
10
tox.ini
10
tox.ini
|
@ -3,14 +3,9 @@ envlist = py26,py27,pep8
|
|||
|
||||
[testenv]
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
NOSE_WITH_OPENSTACK=1
|
||||
NOSE_OPENSTACK_COLOR=1
|
||||
NOSE_OPENSTACK_RED=0.05
|
||||
NOSE_OPENSTACK_YELLOW=0.025
|
||||
NOSE_OPENSTACK_SHOW_ELAPSED=1
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands = nosetests
|
||||
commands = python setup.py testr --slowest --testr-args='{posargs}'
|
||||
|
||||
[testenv:pep8]
|
||||
commands = flake8
|
||||
|
@ -19,7 +14,8 @@ commands = flake8
|
|||
commands = {posargs}
|
||||
|
||||
[testenv:cover]
|
||||
commands = nosetests --cover-erase --cover-package=heatclient --with-xcoverage
|
||||
commands = python setup.py testr --coverage --testr-args='{posargs}'
|
||||
|
||||
|
||||
[tox:jenkins]
|
||||
downloadcache = ~/cache/pip
|
||||
|
|
Loading…
Reference in New Issue