Remove several test dependencies

* oslotest

  We are using just one fixture class(with only one useful code-line) from
  oslotest library. To reduce inheritors and simplify readability of the
  code, let's remove oslotest dependency.

  NOTE: coverage job will fail at master change with trying to import
        oslotest. To fix this issue oslotest is temporary added to `cover`
        tox env and will be removed in follow-up change

* testscenarios

  We do not use this dependency now (or even ever?!)

* coverage

  This library was used before we switched to pytest. Now, all we need
  is pytest-cov

Change-Id: Id0d52f928e067ced5bf4613c291019529b43fbbf
This commit is contained in:
Andrey Kurilin 2018-03-15 13:40:26 +02:00
parent 8c0f380054
commit 97722b179e
4 changed files with 30 additions and 5 deletions

View File

@ -10,6 +10,7 @@ jsonschema>=2.6.0,<3.0.0 # MIT
morph # GPLv3+
netaddr>=0.7.18 # BSD
oslo.config>=5.1.0 # Apache Software License
# do not forget to remove `testresources` from test-requirements. it is a dependency of oslo.db for tests
oslo.db>=4.27.0 # Apache Software License
oslo.log>=3.36.0 # Apache Software License
paramiko>=2.0.0 # LGPL

View File

@ -12,7 +12,6 @@ pytest-html>=1.10.0 # Mozilla Public License
# py.test xdist plugin for distributed testing and loop-on-failing modes
pytest-xdist # MIT
coverage>=4.0,!=4.4 # Apache License, Version 2.0
ddt>=1.0.1 # UNKNOWN
mock>=2.0.0 # UNKNOWN
python-dateutil>=2.4.2 # Simplified BSD
@ -20,7 +19,5 @@ testtools>=2.2.0 # UNKNOWN
sphinx>=1.6.2,!=1.6.6 # BSD
oslosphinx>=4.7.0 # Apache Software License
oslotest>=3.2.0 # Apache Software License
testresources>=2.0.0 # UNKNOWN
testscenarios>=0.4 # UNKNOWN

View File

@ -14,11 +14,12 @@
# under the License.
import fixtures
from fixtures._fixtures.tempdir import TempDir
import os
import uuid
import mock
from oslotest import base
import testtools
from rally.common import cfg
from rally.common import db
@ -26,6 +27,17 @@ from rally import plugins
from tests.unit import fakes
class TempHomeDir(TempDir):
"""Create a temporary directory and set it as $HOME
:ivar path: the path of the temporary directory.
"""
def _setUp(self):
super(TempHomeDir, self)._setUp()
self.useFixture(fixtures.EnvironmentVariable("HOME", self.path))
class DatabaseFixture(cfg.fixture.Config):
"""Create clean DB before starting test."""
def setUp(self):
@ -37,13 +49,23 @@ class DatabaseFixture(cfg.fixture.Config):
db.schema.schema_create()
class TestCase(base.BaseTestCase):
class TestCase(testtools.TestCase):
"""Test case base class for all unit tests."""
def __init__(self, *args, **kwargs):
super(TestCase, self).__init__(*args, **kwargs)
# This is the number of characters shown when two objects do not
# match for assertDictEqual, assertMultiLineEqual, and
# assertSequenceEqual. The default is 640 which is too
# low for comparing most dicts
self.maxDiff = 10000
def setUp(self):
super(TestCase, self).setUp()
self.addCleanup(mock.patch.stopall)
plugins.load()
self.useFixture(TempHomeDir())
def _test_atomic_action_timer(self, atomic_actions, name, count=1,
parent=[]):

View File

@ -74,6 +74,11 @@ commands =
[testenv:cover]
deps =
oslotest
-c {toxinidir}/upper-constraints.txt
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = {toxinidir}/tests/ci/cover.sh {posargs}