]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
Refactor config file reading.
authorTommi Virtanen <tommi.virtanen@dreamhost.com>
Tue, 26 Jul 2011 20:16:34 +0000 (13:16 -0700)
committerTommi Virtanen <tommi.virtanen@dreamhost.com>
Tue, 26 Jul 2011 21:20:28 +0000 (14:20 -0700)
s3tests/common/__init__.py

index 0efda84b7458d9451f87b68ebfa6b87cc884213d..38189ee54f30aa1c5dd0955241639c1e9db17d30 100644 (file)
@@ -84,6 +84,13 @@ def nuke_prefixed_buckets():
 
     print 'Done with cleanup of test buckets.'
 
+def read_config(fp):
+    config = bunch.Bunch()
+    g = yaml.safe_load_all(fp)
+    for new in g:
+        config.update(bunch.bunchify(new))
+    return config
+
 def setup():
     global s3, config, prefix
     s3.clear()
@@ -97,9 +104,7 @@ def setup():
             + 'variable S3TEST_CONF to a config file.',
             )
     with file(path) as f:
-        g = yaml.safe_load_all(f)
-        for new in g:
-            config.update(bunch.bunchify(new))
+        config.update(read_config(f))
 
     # These 3 should always be present.
     if 's3' not in config: