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