Use common tools to run tests
In order to correspond to global requirements and integrate depper with OpenStack CI this patch switches shotgun from py.test and unittest2 to testrepository and oslotest. Partial-bug: #1469045 Change-Id: Ic0abb5e8e62113be300f871b065f9cc48cd381a5
This commit is contained in:
parent
5bae66f476
commit
a9e5b7644a
|
@ -12,8 +12,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from unittest2.case import TestCase
|
||||
from oslotest import base as oslo_base
|
||||
|
||||
|
||||
class BaseTestCase(TestCase):
|
||||
class BaseTestCase(oslo_base.BaseTestCase):
|
||||
"""Base unit test case for shotgun tests."""
|
||||
|
|
|
@ -258,6 +258,8 @@ class TestFile(base.BaseTestCase):
|
|||
|
||||
class TestCommand(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestCommand, self).setUp()
|
||||
|
||||
self.conf = mock.Mock()
|
||||
self.conf.target = '/some/dir'
|
||||
|
||||
|
@ -350,6 +352,8 @@ class TestCommand(base.BaseTestCase):
|
|||
|
||||
class TestDockerCommand(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestDockerCommand, self).setUp()
|
||||
|
||||
self.conf = mock.Mock()
|
||||
self.conf.target = '/some/dir'
|
||||
|
||||
|
|
|
@ -151,8 +151,8 @@ class TestManager(base.BaseTestCase):
|
|||
conf.lastdump = tempfile.mkstemp()[1]
|
||||
conf.self_log_object = {"type": "file", "path": "/path"}
|
||||
manager = Manager(conf)
|
||||
with self.assertRaises(IOError):
|
||||
manager.snapshot()
|
||||
|
||||
self.assertRaises(IOError, manager.snapshot)
|
||||
calls = [mock.call('/target', onerror=mock.ANY) for _ in range(2)]
|
||||
mrmtree.assert_has_calls(calls)
|
||||
|
||||
|
@ -175,6 +175,6 @@ class TestManager(base.BaseTestCase):
|
|||
conf.lastdump = tempfile.mkstemp()[1]
|
||||
conf.self_log_object = {"type": "file", "path": "/path"}
|
||||
manager = Manager(conf)
|
||||
with self.assertRaises(IOError):
|
||||
manager.snapshot()
|
||||
|
||||
self.assertRaises(IOError, manager.snapshot)
|
||||
mrmtree.assert_called_once_with('/target', onerror=mock.ANY)
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
# 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.11,>=0.10.2 # Apache-2.0
|
||||
coverage>=3.6 # Apache-2.0
|
||||
os-testr>=0.4.1 # Apache-2.0
|
||||
oslotest>=1.10.0 # Apache-2.0
|
||||
mock>=1.2 # BSD
|
||||
unittest2 # BSD
|
||||
|
||||
# Packages beyond this line are not in Global Requirements list
|
||||
# and must be added there.
|
||||
pytest==2.8.0
|
||||
pytest-cov==2.1.0
|
||||
|
|
7
tox.ini
7
tox.ini
|
@ -10,18 +10,16 @@ setenv = VIRTUAL_ENV={envdir}
|
|||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands =
|
||||
py.test -vv {posargs:shotgun/test}
|
||||
ostestr {posargs}
|
||||
|
||||
[testenv:pep8]
|
||||
deps = hacking==0.10
|
||||
usedevelop = False
|
||||
commands =
|
||||
flake8 {posargs:shotgun}
|
||||
|
||||
[testenv:cover]
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
commands =
|
||||
py.test -vv --cov=shotgun {posargs:shotgun/test}
|
||||
python setup.py test --coverage {posargs}
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs:}
|
||||
|
@ -31,7 +29,6 @@ envdir = devenv
|
|||
usedevelop = True
|
||||
|
||||
[flake8]
|
||||
ignore = H234,H302,H802
|
||||
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,__init__.py,docs
|
||||
show-pep8 = True
|
||||
show-source = True
|
||||
|
|
Loading…
Reference in New Issue