Merge lp:~greglange/swift/lp702106 into lp:~hudson-openstack/swift/trunk

Proposed by Greg Lange
Status: Merged
Approved by: gholt
Approved revision: 162
Merged at revision: 164
Proposed branch: lp:~greglange/swift/lp702106
Merge into: lp:~hudson-openstack/swift/trunk
Diff against target: 59 lines (+18/-3)
2 files modified
test/functional/swift.py (+5/-0)
test/functional/tests.py (+13/-3)
To merge this branch: bzr merge lp:~greglange/swift/lp702106
Reviewer Review Type Date Requested Status
gholt (community) Approve
Review via email: mp+46041@code.launchpad.net

Description of the change

Made older functional tests look for default config file when env variable is unset

To post a comment you must log in.
Revision history for this message
gholt (gholt) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'test/functional/swift.py'
2--- test/functional/swift.py 2011-01-05 15:17:36 +0000
3+++ test/functional/swift.py 2011-01-12 21:11:47 +0000
4@@ -24,6 +24,7 @@
5
6 import simplejson as json
7
8+from nose import SkipTest
9 from xml.dom import minidom
10
11 class AuthenticationFailed(Exception):
12@@ -79,6 +80,10 @@
13
14 class Connection(object):
15 def __init__(self, config):
16+ for key in 'auth_host auth_port auth_ssl account username password'.split():
17+ if not config.has_key(key):
18+ raise SkipTest
19+
20 self.auth_host = config['auth_host']
21 self.auth_port = int(config['auth_port'])
22 self.auth_ssl = config['auth_ssl'] in ('on', 'true', 'yes', '1')
23
24=== modified file 'test/functional/tests.py'
25--- test/functional/tests.py 2011-01-04 23:34:43 +0000
26+++ test/functional/tests.py 2011-01-12 21:11:47 +0000
27@@ -19,8 +19,10 @@
28 from datetime import datetime
29 import locale
30 import os
31+import os.path
32 import random
33 import StringIO
34+import sys
35 import time
36 import threading
37 import uuid
38@@ -30,11 +32,19 @@
39 from swift import Account, AuthenticationFailed, Connection, Container, \
40 File, ResponseError
41
42-config = configobj.ConfigObj(os.environ['SWIFT_TEST_CONFIG_FILE'])
43+config_file_env_var = 'SWIFT_TEST_CONFIG_FILE'
44+default_config_file = '/etc/swift/func_test.conf'
45+
46+if os.environ.has_key(config_file_env_var):
47+ config_file = os.environ[config_file_env_var]
48+elif os.path.isfile(default_config_file):
49+ config_file = default_config_file
50+else:
51+ print >>sys.stderr, 'SKIPPING FUNCTIONAL TESTS DUE TO NO CONFIG'
52+
53+config = configobj.ConfigObj(config_file)
54 locale.setlocale(locale.LC_COLLATE, config.get('collate', 'C'))
55
56-NoRun = object
57-
58 class Base:
59 pass
60