Migrate fully to ostestr

Following commit migrates python-monascaclient
fully to os-testr and oslo.test

Additionally:
- removed mock requirement (unused)
- removed sphinx requirement (unused)

Change-Id: If534134ced5081ccdf40ab7963e087e29672608d
This commit is contained in:
Tomasz Trębski 2017-02-16 07:08:59 +01:00
parent dc69217aea
commit f9696d6816
4 changed files with 67 additions and 22 deletions

View File

@ -1,4 +1,9 @@
[DEFAULT]
test_command=${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION
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 $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list
group_regex=monascaclient\.tests(?:\.|_)([^_]+)

View File

@ -19,16 +19,22 @@ import sys
import fixtures
from keystoneclient.v3 import client as ksclient
from mox3 import mox
from oslotest import base
from requests_mock.contrib import fixture as requests_mock_fixture
import six
import testtools
from monascaclient import exc
import monascaclient.shell
from monascaclient.tests import fakes
class TestCase(testtools.TestCase):
class TestCase(base.BaseTestCase):
def setUp(self):
super(TestCase, self).setUp()
def tearDown(self):
super(TestCase, self).tearDown()
def set_fake_env(self, fake_env):
client_env = ('OS_USERNAME', 'OS_PASSWORD', 'OS_USER_DOMAIN_ID',

View File

@ -1,14 +1,14 @@
# 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.13.0,<0.14,>=0.12.0 # Apache-2.0
bandit>=1.1.0 # Apache-2.0
coverage>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
hacking<0.12,>=0.11.0 # Apache-2.0
mock>=2.0 # BSD
mox3!=0.19.0,>=0.7.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0
os-testr>=0.8.0 # Apache-2.0
requests-mock>=1.1 # Apache-2.0
sphinx>=1.5.1 # BSD
testrepository>=0.0.18 # Apache-2.0/BSD
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=1.4.0 # MIT

66
tox.ini
View File

@ -1,6 +1,6 @@
[tox]
envlist = py35,py27,pypy,pep8
minversion = 2.0
envlist = py{27,35},pypy,cover,pep8
minversion = 2.5
skipsdist = True
[testenv]
@ -8,39 +8,73 @@ setenv =
VIRTUAL_ENV={envdir}
BRANCH_NAME=master
CLIENT_NAME=python-monascaclient
OS_TEST_PATH=monascaclient/tests
passenv = http_proxy
HTTP_PROXY
https_proxy
HTTPS_PROXY
no_proxy
NO_PROXY
usedevelop = True
install_command =
{toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
whitelist_externals = find
whitelist_externals = bash
find
rm
commands =
find . -type f -name "*.pyc" -delete
python setup.py testr --slowest --testr-args='{posargs}'
[testenv:pep8]
deps =
{[testenv]deps}
[testenv:py27]
basepython = python2.7
commands =
{[testenv:flake8]commands}
{[bandit]commands}
{[testenv]commands}
ostestr {posargs}
[testenv:venv]
commands = {posargs}
[testenv:py35]
basepython = python3.5
commands =
{[testenv]commands}
ostestr {posargs}
[testenv:pypy]
basepython = pypy
commands =
{[testenv]commands}
ostestr {posargs}
[testenv:cover]
commands = python setup.py testr --coverage --testr-args='{posargs}'
basepython = python2.7
commands =
{[testenv]commands}
coverage erase
python setup.py test --coverage --testr-args='{posargs}' --coverage-package-name=monascaclient
coverage report
[testenv:debug]
commands =
{[testenv]commands}
oslo_debug_helper -t {env:OS_TEST_PATH} {posargs}
[testenv:pep8]
commands =
{[testenv:flake8]commands}
{[testenv:bandit]commands}
[testenv:flake8]
commands =
flake8 monascaclient
[testenv:bandit]
commands =
bandit -r monascaclient -n5 -x {env:OS_TEST_PATH}
[testenv:venv]
commands = {posargs}
[flake8]
show-source = True
max-line-length = 120
builtins = _
exclude=.venv,.git,.tox,dist,client_api_example.py,*lib/python*,*egg,build
[bandit]
commands =
bandit -r monascaclient -n5 -x monascaclient/tests