tests: Get rid of test.unit.SkipTest
unittest.SkipTest suffices. Change-Id: I11eb73f7dc4a8598fae85d1efca721f69067fb4f
This commit is contained in:
parent
8778b2c132
commit
be16d6c4fd
@ -33,6 +33,7 @@ from contextlib import closing
|
||||
from gzip import GzipFile
|
||||
from shutil import rmtree
|
||||
from tempfile import mkdtemp
|
||||
from unittest import SkipTest
|
||||
|
||||
from six.moves.configparser import ConfigParser, NoSectionError
|
||||
from six.moves import http_client
|
||||
@ -47,10 +48,8 @@ from test import get_config, listen_zero
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import FakeMemcache
|
||||
# importing skip_if_no_xattrs so that functional tests can grab it from the
|
||||
# test.functional namespace. Importing SkipTest so this works under both
|
||||
# nose and testr test runners.
|
||||
# test.functional namespace.
|
||||
from test.unit import skip_if_no_xattrs as real_skip_if_no_xattrs
|
||||
from test.unit import SkipTest
|
||||
|
||||
from swift.common import constraints, utils, ring, storage_policy
|
||||
from swift.common.ring import Ring
|
||||
|
@ -17,6 +17,8 @@ import unittest
|
||||
import traceback
|
||||
from contextlib import contextmanager
|
||||
import logging
|
||||
from unittest import SkipTest
|
||||
|
||||
import test.functional as tf
|
||||
from test.functional.s3api.s3_test_client import (
|
||||
Connection, get_boto3_conn, tear_down_s3)
|
||||
@ -45,7 +47,7 @@ class S3ApiBase(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
if 's3api' not in tf.cluster_info:
|
||||
raise tf.SkipTest('s3api middleware is not enabled')
|
||||
raise SkipTest('s3api middleware is not enabled')
|
||||
if tf.config.get('account'):
|
||||
user_id = '%s:%s' % (tf.config['account'], tf.config['username'])
|
||||
else:
|
||||
@ -82,7 +84,7 @@ class S3ApiBase(unittest.TestCase):
|
||||
class S3ApiBaseBoto3(S3ApiBase):
|
||||
def setUp(self):
|
||||
if 's3api' not in tf.cluster_info:
|
||||
raise tf.SkipTest('s3api middleware is not enabled')
|
||||
raise SkipTest('s3api middleware is not enabled')
|
||||
try:
|
||||
self.conn = get_boto3_conn(
|
||||
tf.config['s3_access_key'], tf.config['s3_secret_key'])
|
||||
|
@ -17,6 +17,7 @@ import unittest
|
||||
import os
|
||||
import test.functional as tf
|
||||
from swift.common.middleware.s3api.etree import fromstring
|
||||
from unittest import SkipTest
|
||||
from test.functional.s3api import S3ApiBase
|
||||
from test.functional.s3api.s3_test_client import Connection
|
||||
from test.functional.s3api.utils import get_error_code
|
||||
@ -37,7 +38,7 @@ class TestS3Acl(S3ApiBase):
|
||||
self.obj = 'object'
|
||||
if 's3_access_key3' not in tf.config or \
|
||||
's3_secret_key3' not in tf.config:
|
||||
raise tf.SkipTest(
|
||||
raise SkipTest(
|
||||
'TestS3Acl requires s3_access_key3 and s3_secret_key3 '
|
||||
'configured for reduced-access user')
|
||||
status, headers, body = self.conn.make_request('PUT', self.bucket)
|
||||
|
@ -17,6 +17,7 @@ import botocore
|
||||
import datetime
|
||||
import unittest
|
||||
import os
|
||||
from unittest import SkipTest
|
||||
|
||||
import test.functional as tf
|
||||
from swift.common.utils import config_true_value
|
||||
@ -123,7 +124,7 @@ class TestS3ApiBucket(S3ApiBaseBoto3):
|
||||
|
||||
def test_bucket_listing_with_staticweb(self):
|
||||
if 'staticweb' not in tf.cluster_info:
|
||||
raise tf.SkipTest('Staticweb not enabled')
|
||||
raise SkipTest('Staticweb not enabled')
|
||||
bucket = 'bucket'
|
||||
|
||||
resp = self.conn.create_bucket(Bucket=bucket)
|
||||
@ -176,7 +177,7 @@ class TestS3ApiBucket(S3ApiBaseBoto3):
|
||||
if config_true_value(tf.cluster_info['s3api'].get('s3_acl')):
|
||||
if 's3_access_key2' not in tf.config or \
|
||||
's3_secret_key2' not in tf.config:
|
||||
raise tf.SkipTest(
|
||||
raise SkipTest(
|
||||
'Cannot test for BucketAlreadyExists with second user; '
|
||||
'need s3_access_key2 and s3_secret_key2 configured')
|
||||
|
||||
@ -196,8 +197,8 @@ class TestS3ApiBucket(S3ApiBaseBoto3):
|
||||
def test_put_bucket_error_key3(self):
|
||||
if 's3_access_key3' not in tf.config or \
|
||||
's3_secret_key3' not in tf.config:
|
||||
raise tf.SkipTest('Cannot test for AccessDenied; need '
|
||||
's3_access_key3 and s3_secret_key3 configured')
|
||||
raise SkipTest('Cannot test for AccessDenied; need '
|
||||
's3_access_key3 and s3_secret_key3 configured')
|
||||
|
||||
self.conn.create_bucket(Bucket='bucket')
|
||||
# If the user can't create buckets, they shouldn't even know
|
||||
|
@ -52,7 +52,7 @@ class TestS3ApiMultiUpload(S3ApiBase):
|
||||
def setUp(self):
|
||||
super(TestS3ApiMultiUpload, self).setUp()
|
||||
if not tf.cluster_info['s3api'].get('allow_multipart_uploads', False):
|
||||
raise tf.SkipTest('multipart upload is not enebled')
|
||||
self.skipTest('multipart upload is not enebled')
|
||||
|
||||
self.min_segment_size = int(tf.cluster_info['s3api'].get(
|
||||
'min_segment_size', 5242880))
|
||||
|
@ -33,8 +33,8 @@ class TestS3ApiVersioning(S3ApiBase):
|
||||
super(TestS3ApiVersioning, self).setUp()
|
||||
if 'object_versioning' not in tf.cluster_info:
|
||||
# Alternatively, maybe we should assert we get 501s...
|
||||
raise tf.SkipTest('S3 versioning requires that Swift object '
|
||||
'versioning be enabled')
|
||||
self.skipTest('S3 versioning requires that Swift object '
|
||||
'versioning be enabled')
|
||||
status, headers, body = self.conn.make_request('PUT', 'bucket')
|
||||
self.assertEqual(status, 200)
|
||||
|
||||
|
@ -250,7 +250,7 @@ class TestDlo(Base):
|
||||
|
||||
def test_dlo_referer_on_segment_container(self):
|
||||
if 'username3' not in tf.config:
|
||||
raise tf.SkipTest('Requires user 3')
|
||||
self.skipTest('Requires user 3')
|
||||
# First the account2 (test3) should fail
|
||||
config2 = tf.config.copy()
|
||||
config2['username'] = tf.config['username3']
|
||||
|
@ -20,13 +20,14 @@ import json
|
||||
import unittest
|
||||
from uuid import uuid4
|
||||
import time
|
||||
from unittest import SkipTest
|
||||
from xml.dom import minidom
|
||||
|
||||
import six
|
||||
from six.moves import range
|
||||
|
||||
from test.functional import check_response, retry, requires_acls, \
|
||||
requires_policies, SkipTest, requires_bulk
|
||||
requires_policies, requires_bulk
|
||||
import test.functional as tf
|
||||
from swift.common.utils import md5
|
||||
|
||||
@ -941,7 +942,7 @@ class TestObject(unittest.TestCase):
|
||||
@requires_acls
|
||||
def test_read_only(self):
|
||||
if tf.skip3:
|
||||
raise tf.SkipTest
|
||||
raise SkipTest
|
||||
|
||||
def get_listing(url, token, parsed, conn):
|
||||
conn.request('GET', '%s/%s' % (parsed.path, self.container), '',
|
||||
|
@ -22,6 +22,7 @@ import six
|
||||
|
||||
from copy import deepcopy
|
||||
from six.moves.urllib.parse import quote, unquote
|
||||
from unittest import SkipTest
|
||||
|
||||
import test.functional as tf
|
||||
|
||||
@ -31,7 +32,7 @@ from swift.common.middleware.versioned_writes.object_versioning import \
|
||||
DELETE_MARKER_CONTENT_TYPE
|
||||
|
||||
from test.functional.tests import Base, Base2, BaseEnv, Utils
|
||||
from test.functional import cluster_info, SkipTest
|
||||
from test.functional import cluster_info
|
||||
from test.functional.swift_test_client import Connection, \
|
||||
ResponseError
|
||||
from test.functional.test_tempurl import TestContainerTempurlEnv, \
|
||||
|
@ -19,6 +19,7 @@ import email.parser
|
||||
import itertools
|
||||
import json
|
||||
from copy import deepcopy
|
||||
from unittest import SkipTest
|
||||
|
||||
import six
|
||||
|
||||
@ -26,7 +27,7 @@ from swift.common.swob import normalize_etag
|
||||
from swift.common.utils import md5
|
||||
|
||||
import test.functional as tf
|
||||
from test.functional import cluster_info, SkipTest
|
||||
from test.functional import cluster_info
|
||||
from test.functional.tests import Utils, Base, Base2, BaseEnv
|
||||
from test.functional.swift_test_client import Connection, ResponseError
|
||||
|
||||
|
@ -23,12 +23,13 @@ from copy import deepcopy
|
||||
import six
|
||||
from six.moves import urllib
|
||||
from time import time, strftime, gmtime
|
||||
from unittest import SkipTest
|
||||
|
||||
import test.functional as tf
|
||||
from swift.common.middleware import tempurl
|
||||
from test.functional import cluster_info
|
||||
from test.functional.tests import Utils, Base, Base2, BaseEnv
|
||||
from test.functional import requires_acls, SkipTest
|
||||
from test.functional import requires_acls
|
||||
from test.functional.swift_test_client import Account, Connection, \
|
||||
ResponseError
|
||||
|
||||
|
@ -20,12 +20,13 @@ import time
|
||||
import unittest
|
||||
import six
|
||||
from six.moves.urllib.parse import quote, unquote
|
||||
from unittest import SkipTest
|
||||
|
||||
import test.functional as tf
|
||||
|
||||
from swift.common.utils import MD5_OF_EMPTY_STRING
|
||||
from test.functional.tests import Base, Base2, BaseEnv, Utils
|
||||
from test.functional import cluster_info, SkipTest
|
||||
from test.functional import cluster_info
|
||||
from test.functional.swift_test_client import Account, Connection, \
|
||||
ResponseError
|
||||
|
||||
|
@ -64,11 +64,7 @@ import functools
|
||||
from gzip import GzipFile
|
||||
import mock as mocklib
|
||||
import inspect
|
||||
import unittest
|
||||
|
||||
|
||||
class SkipTest(unittest.SkipTest):
|
||||
pass
|
||||
from unittest import SkipTest
|
||||
|
||||
|
||||
EMPTY_ETAG = md5(usedforsecurity=False).hexdigest()
|
||||
|
Loading…
Reference in New Issue
Block a user