Drop use of unittest2
unittest2 was needed for Python versions <= 2.6, so it has not been needed for quite awhile (ever in this project). See unittest2 note on: https://docs.python.org/2.7/library/unittest.html This drops unittest2 in favor of the standard unittest module. Change-Id: I21264290d783d582dfb886b799781380dbf5757d Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
@@ -17,11 +17,11 @@ import functools
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import strutils
|
||||
import six
|
||||
import unittest2
|
||||
import yaml
|
||||
|
||||
import cinderlib
|
||||
@@ -57,7 +57,7 @@ def get_bool_env(param_string, default=False):
|
||||
return strutils.bool_from_string(param, strict=True)
|
||||
|
||||
|
||||
class BaseFunctTestCase(unittest2.TestCase):
|
||||
class BaseFunctTestCase(unittest.TestCase):
|
||||
FNULL = open(os.devnull, 'w')
|
||||
CONFIG_FILE = os.environ.get('CL_FTEST_CFG', '/etc/cinder/cinder.conf')
|
||||
PRECISION = os.environ.get('CL_FTEST_PRECISION', 0)
|
||||
|
||||
@@ -20,7 +20,7 @@ import cinderlib
|
||||
from cinderlib.tests.functional import base_tests
|
||||
|
||||
|
||||
class BaseFunctTestCase(base_tests.unittest2.TestCase):
|
||||
class BaseFunctTestCase(base_tests.unittest.TestCase):
|
||||
def test_list_supported_drivers(self):
|
||||
expected_keys = {'version', 'class_name', 'supported', 'ci_wiki_name',
|
||||
'driver_options', 'class_fqn', 'desc'}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
|
||||
import mock
|
||||
import unittest2
|
||||
import unittest
|
||||
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
@@ -38,7 +38,7 @@ _replace_oslo_cli_parse()
|
||||
cinderlib.setup(persistence_config={'storage': utils.get_mock_persistence()})
|
||||
|
||||
|
||||
class BaseTest(unittest2.TestCase):
|
||||
class BaseTest(unittest.TestCase):
|
||||
PERSISTENCE_CFG = None
|
||||
|
||||
def setUp(self):
|
||||
|
||||
@@ -386,7 +386,7 @@ class BasePersistenceTest(helper.TestHelper):
|
||||
@mock.patch('cinderlib.persistence.base.DB.volume_type_get')
|
||||
def test__volume_type_get_by_name(self, get_mock):
|
||||
# Only test when using our fake DB class. We cannot use
|
||||
# unittest2.skipUnless because persistence is configure in setUpClass,
|
||||
# unittest.skipUnless because persistence is configure in setUpClass,
|
||||
# which is called after the decorator.
|
||||
if not isinstance(cinderlib.objects.Backend.persistence.db,
|
||||
persistence_base.DB):
|
||||
@@ -414,7 +414,7 @@ class BasePersistenceTest(helper.TestHelper):
|
||||
|
||||
def test_volume_get_all_by_host(self):
|
||||
# Only test when using our fake DB class. We cannot use
|
||||
# unittest2.skipUnless because persistence is configure in setUpClass,
|
||||
# unittest.skipUnless because persistence is configure in setUpClass,
|
||||
# which is called after the decorator.
|
||||
if not isinstance(cinderlib.objects.Backend.persistence.db,
|
||||
persistence_base.DB):
|
||||
@@ -442,7 +442,7 @@ class BasePersistenceTest(helper.TestHelper):
|
||||
|
||||
def test__volume_admin_metadata_get(self):
|
||||
# Only test when using our fake DB class. We cannot use
|
||||
# unittest2.skipUnless because persistence is configure in setUpClass,
|
||||
# unittest.skipUnless because persistence is configure in setUpClass,
|
||||
# which is called after the decorator.
|
||||
if not isinstance(cinderlib.objects.Backend.persistence.db,
|
||||
persistence_base.DB):
|
||||
@@ -457,7 +457,7 @@ class BasePersistenceTest(helper.TestHelper):
|
||||
|
||||
def test__volume_admin_metadata_update(self):
|
||||
# Only test when using our fake DB class. We cannot use
|
||||
# unittest2.skipUnless because persistence is configure in setUpClass,
|
||||
# unittest.skipUnless because persistence is configure in setUpClass,
|
||||
# which is called after the decorator.
|
||||
if not isinstance(cinderlib.objects.Backend.persistence.db,
|
||||
persistence_base.DB):
|
||||
@@ -480,7 +480,7 @@ class BasePersistenceTest(helper.TestHelper):
|
||||
|
||||
def test__volume_admin_metadata_update_do_nothing(self):
|
||||
# Only test when using our fake DB class. We cannot use
|
||||
# unittest2.skipUnless because persistence is configure in setUpClass,
|
||||
# unittest.skipUnless because persistence is configure in setUpClass,
|
||||
# which is called after the decorator.
|
||||
if not isinstance(cinderlib.objects.Backend.persistence.db,
|
||||
persistence_base.DB):
|
||||
@@ -504,7 +504,7 @@ class BasePersistenceTest(helper.TestHelper):
|
||||
|
||||
def test_volume_admin_metadata_delete(self):
|
||||
# Only test when using our fake DB class. We cannot use
|
||||
# unittest2.skipUnless because persistence is configure in setUpClass,
|
||||
# unittest.skipUnless because persistence is configure in setUpClass,
|
||||
# which is called after the decorator.
|
||||
if not isinstance(cinderlib.objects.Backend.persistence.db,
|
||||
persistence_base.DB):
|
||||
|
||||
@@ -131,7 +131,7 @@ run:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
$ python -m unittest2 discover -v cinderlib.tests.functional
|
||||
$ python -m unittest discover -v cinderlib.tests.functional
|
||||
|
||||
test_attach_detach_volume_on_lvmdriver-1 (cinderlib.tests.functional.test_basic.BackendFunctBasic) ... ok
|
||||
test_attach_detach_volume_via_attachment_on_lvmdriver-1 (cinderlib.tests.functional.test_basic.BackendFunctBasic) ... ok
|
||||
@@ -310,7 +310,7 @@ provides a custom configuration YAML file with the backend configuration::
|
||||
For jobs in the *cinderlib* project you can use the
|
||||
``openstack-tox-functional-with-sudo`` parent, but for jobs in the *Cinder*
|
||||
project you'll have to call this yourself by calling tox or using the same
|
||||
command we used during our manual testing: ``python -m unittest2 discover -v
|
||||
command we used during our manual testing: ``python -m unittest discover -v
|
||||
cinderlib.tests.functional``.
|
||||
|
||||
Use existing job
|
||||
|
||||
@@ -13,5 +13,4 @@ Sphinx==1.6.2
|
||||
sphixcontrib-websupport==1.0.1
|
||||
stestr==1.0.0
|
||||
stevedore==1.20.0
|
||||
unittest2==1.1.0
|
||||
urllib3==1.21.1
|
||||
|
||||
Reference in New Issue
Block a user