Fix func test --until-failure and --no-discover options

This patch changes functional test classes to subclass
unittest2.TestCase rather than unittest.TestCase.
This fixes errors when attempting to use

tox -e func -- -n <test_path_including_test_method>

and

tox -e func -- --until-failure

Also migrate from using nose.SkipTest to unittest2.SkipTest

Change-Id: I903033f5e01833550b2f2b945894edca4233c4a2
Closes-Bug: 1526725
Co-Authored-By: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
This commit is contained in:
Alistair Coles 2015-12-16 15:28:25 +00:00
parent ef8ae0a8ce
commit 169a7c7f9e
7 changed files with 22 additions and 24 deletions

View File

@ -1,6 +1,4 @@
[DEFAULT]
test_command=SWIFT_TEST_DEBUG_LOGS=${SWIFT_TEST_DEBUG_LOGS} \
${PYTHON:-python} -m subunit.run \
discover -t ./ ${TESTS_DIR:-./test/functional/} $LISTOPT $IDOPTION
test_command=SWIFT_TEST_DEBUG_LOGS=${SWIFT_TEST_DEBUG_LOGS} ${PYTHON:-python} -m subunit.run discover -t ./ ${TESTS_DIR:-./test/functional/} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -27,11 +27,11 @@ import functools
import random
from time import time, sleep
from nose import SkipTest
from contextlib import closing
from gzip import GzipFile
from shutil import rmtree
from tempfile import mkdtemp
from unittest2 import SkipTest
from six.moves.configparser import ConfigParser, NoSectionError
from six.moves import http_client

View File

@ -20,7 +20,7 @@ import random
import socket
import time
from nose import SkipTest
from unittest2 import SkipTest
from xml.dom import minidom
import six

View File

@ -15,10 +15,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import unittest2
import json
from uuid import uuid4
from nose import SkipTest
from unittest2 import SkipTest
from string import letters
from six.moves import range
@ -37,7 +37,7 @@ def tearDownModule():
tf.teardown_package()
class TestAccount(unittest.TestCase):
class TestAccount(unittest2.TestCase):
def setUp(self):
self.max_meta_count = load_constraint('max_meta_count')
@ -862,7 +862,7 @@ class TestAccount(unittest.TestCase):
self.assertEqual(resp.status, 400)
class TestAccountInNonDefaultDomain(unittest.TestCase):
class TestAccountInNonDefaultDomain(unittest2.TestCase):
def setUp(self):
if tf.skip or tf.skip2 or tf.skip_if_not_v3:
raise SkipTest('AUTH VERSION 3 SPECIFIC TEST')
@ -891,4 +891,4 @@ class TestAccountInNonDefaultDomain(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
unittest2.main()

View File

@ -16,8 +16,8 @@
# limitations under the License.
import json
import unittest
from nose import SkipTest
import unittest2
from unittest2 import SkipTest
from uuid import uuid4
from test.functional import check_response, retry, requires_acls, \
@ -35,7 +35,7 @@ def tearDownModule():
tf.teardown_package()
class TestContainer(unittest.TestCase):
class TestContainer(unittest2.TestCase):
def setUp(self):
if tf.skip:
@ -1559,7 +1559,7 @@ class TestContainer(unittest.TestCase):
policy['name'])
class BaseTestContainerACLs(unittest.TestCase):
class BaseTestContainerACLs(unittest2.TestCase):
# subclasses can change the account in which container
# is created/deleted by setUp/tearDown
account = 1
@ -1734,4 +1734,4 @@ class TestContainerACLsAccount4(BaseTestContainerACLs):
if __name__ == '__main__':
unittest.main()
unittest2.main()

View File

@ -16,8 +16,8 @@
# limitations under the License.
import json
import unittest
from nose import SkipTest
import unittest2
from unittest2 import SkipTest
from uuid import uuid4
from six.moves import range
@ -35,7 +35,7 @@ def tearDownModule():
tf.teardown_package()
class TestObject(unittest.TestCase):
class TestObject(unittest2.TestCase):
def setUp(self):
if tf.skip:
@ -1254,4 +1254,4 @@ class TestObject(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
unittest2.main()

View File

@ -25,11 +25,11 @@ import random
import six
from six.moves import urllib
import time
import unittest
import unittest2
import uuid
from copy import deepcopy
import eventlet
from nose import SkipTest
from unittest2 import SkipTest
from swift.common.http import is_success, is_client_error
from test.functional import normalized_urls, load_constraint, cluster_info
@ -70,7 +70,7 @@ class Utils(object):
create_name = create_ascii_name
class Base(unittest.TestCase):
class Base(unittest2.TestCase):
def setUp(self):
cls = type(self)
if not cls.set_up:
@ -4148,7 +4148,7 @@ class TestSloTempurlUTF8(Base2, TestSloTempurl):
set_up = False
class TestServiceToken(unittest.TestCase):
class TestServiceToken(unittest2.TestCase):
def setUp(self):
if tf.skip_service_tokens:
@ -4316,4 +4316,4 @@ class TestServiceToken(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
unittest2.main()