mirror of
https://github.com/ceph/s3-tests.git
synced 2024-12-22 19:19:12 +00:00
pytest: add global configfile and autouse teardown fixtures
Signed-off-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
parent
9319a41b24
commit
672a123348
10 changed files with 37 additions and 0 deletions
|
@ -7,6 +7,7 @@ import itertools
|
|||
import os
|
||||
import random
|
||||
import string
|
||||
import pytest
|
||||
from http.client import HTTPConnection, HTTPSConnection
|
||||
from urllib.parse import urlparse
|
||||
|
||||
|
@ -370,6 +371,15 @@ def teardown():
|
|||
# remove our buckets here also, to avoid littering
|
||||
nuke_prefixed_buckets(prefix=prefix)
|
||||
|
||||
@pytest.fixture(scope="package")
|
||||
def configfile():
|
||||
setup()
|
||||
yield config
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup_teardown(configfile):
|
||||
yield
|
||||
teardown()
|
||||
|
||||
bucket_counter = itertools.count(1)
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ from .utils import assert_raises
|
|||
from email.header import decode_header
|
||||
|
||||
from . import (
|
||||
configfile,
|
||||
setup_teardown,
|
||||
_make_raw_request,
|
||||
nuke_prefixed_buckets,
|
||||
get_new_bucket,
|
||||
|
|
|
@ -37,6 +37,8 @@ from .utils import assert_raises
|
|||
from .policy import Policy, Statement, make_json_policy
|
||||
|
||||
from . import (
|
||||
configfile,
|
||||
setup_teardown,
|
||||
nuke_prefixed_buckets,
|
||||
get_new_bucket,
|
||||
get_new_bucket_name,
|
||||
|
|
|
@ -19,6 +19,8 @@ from nose.plugins.skip import SkipTest
|
|||
from .. import common
|
||||
|
||||
from . import (
|
||||
configfile,
|
||||
setup_teardown,
|
||||
get_new_bucket,
|
||||
get_new_bucket_name,
|
||||
s3,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import pytest
|
||||
import boto3
|
||||
from botocore import UNSIGNED
|
||||
from botocore.client import Config
|
||||
|
@ -308,6 +309,16 @@ def teardown():
|
|||
except:
|
||||
pass
|
||||
|
||||
@pytest.fixture(scope="package")
|
||||
def configfile():
|
||||
setup()
|
||||
return config
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup_teardown(configfile):
|
||||
yield
|
||||
teardown()
|
||||
|
||||
def check_webidentity():
|
||||
cfg = configparser.RawConfigParser()
|
||||
try:
|
||||
|
|
|
@ -10,6 +10,8 @@ from .utils import _get_status_and_error_code
|
|||
from .utils import _get_status
|
||||
|
||||
from . import (
|
||||
configfile,
|
||||
setup_teardown,
|
||||
get_client,
|
||||
get_v2_client,
|
||||
get_new_bucket,
|
||||
|
|
|
@ -7,6 +7,8 @@ from nose.tools import eq_ as eq
|
|||
from s3tests_boto3.functional.utils import assert_raises
|
||||
from s3tests_boto3.functional.test_s3 import _multipart_upload
|
||||
from . import (
|
||||
configfile,
|
||||
setup_teardown,
|
||||
get_alt_client,
|
||||
get_iam_client,
|
||||
get_new_bucket,
|
||||
|
|
|
@ -41,6 +41,8 @@ from .utils import _get_status
|
|||
from .policy import Policy, Statement, make_json_policy
|
||||
|
||||
from . import (
|
||||
configfile,
|
||||
setup_teardown,
|
||||
get_client,
|
||||
get_prefix,
|
||||
get_unauthenticated_client,
|
||||
|
|
|
@ -9,6 +9,8 @@ import uuid
|
|||
from nose.tools import eq_ as eq
|
||||
|
||||
from . import (
|
||||
configfile,
|
||||
setup_teardown,
|
||||
get_client
|
||||
)
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@ from collections import namedtuple
|
|||
from email.header import decode_header
|
||||
|
||||
from . import(
|
||||
configfile,
|
||||
setup_teardown,
|
||||
get_iam_client,
|
||||
get_sts_client,
|
||||
get_client,
|
||||
|
|
Loading…
Reference in a new issue