Made older functional tests look for default config file when env variable is unset
This commit is contained in:
parent
2962557612
commit
e5c5a3778e
@ -24,6 +24,7 @@ import urllib
|
||||
|
||||
import simplejson as json
|
||||
|
||||
from nose import SkipTest
|
||||
from xml.dom import minidom
|
||||
|
||||
class AuthenticationFailed(Exception):
|
||||
@ -79,6 +80,10 @@ def listing_items(method):
|
||||
|
||||
class Connection(object):
|
||||
def __init__(self, config):
|
||||
for key in 'auth_host auth_port auth_ssl account username password'.split():
|
||||
if not config.has_key(key):
|
||||
raise SkipTest
|
||||
|
||||
self.auth_host = config['auth_host']
|
||||
self.auth_port = int(config['auth_port'])
|
||||
self.auth_ssl = config['auth_ssl'] in ('on', 'true', 'yes', '1')
|
||||
|
@ -19,8 +19,10 @@ import configobj
|
||||
from datetime import datetime
|
||||
import locale
|
||||
import os
|
||||
import os.path
|
||||
import random
|
||||
import StringIO
|
||||
import sys
|
||||
import time
|
||||
import threading
|
||||
import uuid
|
||||
@ -30,10 +32,18 @@ import urllib
|
||||
from swift import Account, AuthenticationFailed, Connection, Container, \
|
||||
File, ResponseError
|
||||
|
||||
config = configobj.ConfigObj(os.environ['SWIFT_TEST_CONFIG_FILE'])
|
||||
locale.setlocale(locale.LC_COLLATE, config.get('collate', 'C'))
|
||||
config_file_env_var = 'SWIFT_TEST_CONFIG_FILE'
|
||||
default_config_file = '/etc/swift/func_test.conf'
|
||||
|
||||
NoRun = object
|
||||
if os.environ.has_key(config_file_env_var):
|
||||
config_file = os.environ[config_file_env_var]
|
||||
elif os.path.isfile(default_config_file):
|
||||
config_file = default_config_file
|
||||
else:
|
||||
print >>sys.stderr, 'SKIPPING FUNCTIONAL TESTS DUE TO NO CONFIG'
|
||||
|
||||
config = configobj.ConfigObj(config_file)
|
||||
locale.setlocale(locale.LC_COLLATE, config.get('collate', 'C'))
|
||||
|
||||
class Base:
|
||||
pass
|
||||
|
Loading…
x
Reference in New Issue
Block a user