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] [DEFAULT]
test_command=SWIFT_TEST_DEBUG_LOGS=${SWIFT_TEST_DEBUG_LOGS} \ test_command=SWIFT_TEST_DEBUG_LOGS=${SWIFT_TEST_DEBUG_LOGS} ${PYTHON:-python} -m subunit.run discover -t ./ ${TESTS_DIR:-./test/functional/} $LISTOPT $IDOPTION
${PYTHON:-python} -m subunit.run \
discover -t ./ ${TESTS_DIR:-./test/functional/} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE test_id_option=--load-list $IDFILE
test_list_option=--list test_list_option=--list

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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