summaryrefslogtreecommitdiffstats
path: root/test/__init__.py
diff options
context:
space:
mode:
authorPeter Portante <peter.portante@redhat.com>2013-04-29 23:04:06 -0400
committerPeter Portante <pportant@redhat.com>2013-05-10 07:12:08 -0700
commit3a75da67cbcf09c19df2a9dca2f576d51ed2191d (patch)
tree8feb591c6126161691b375cbec9c2c64bff2182c /test/__init__.py
parentf534d66a4a29ebf7ca070f95cf33b57b4b7283a3 (diff)
Remove "ufo" directory, promoting contents to top-level
Additionally, we drop the "ufo" references from setup.py, spec file and README, and add the HISTORY file describing how the repo was initially created. We also update the RPM spec file to use the name "gluster-for-swift" to avoid colliding with existing RPM names from RHS 2.0 (the spec file's description was also updated, along with the version number). Change-Id: If804224a94208d57896e4189c63736ffc9e01d5e Signed-off-by: Peter Portante <peter.portante@redhat.com> Reviewed-on: http://review.gluster.org/4966 Reviewed-by: Luis Pabon <lpabon@redhat.com> Reviewed-by: Mohammed Junaid <junaid@redhat.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Peter Portante <pportant@redhat.com> Tested-by: Peter Portante <pportant@redhat.com>
Diffstat (limited to 'test/__init__.py')
-rw-r--r--test/__init__.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/__init__.py b/test/__init__.py
new file mode 100644
index 0000000..50b24ed
--- /dev/null
+++ b/test/__init__.py
@@ -0,0 +1,49 @@
+# See http://code.google.com/p/python-nose/issues/detail?id=373
+# The code below enables nosetests to work with i18n _() blocks
+
+import __builtin__
+import sys
+import os
+from ConfigParser import MissingSectionHeaderError
+from StringIO import StringIO
+
+from swift.common.utils import readconf
+
+setattr(__builtin__, '_', lambda x: x)
+
+
+# Work around what seems to be a Python bug.
+# c.f. https://bugs.launchpad.net/swift/+bug/820185.
+import logging
+logging.raiseExceptions = False
+
+
+def get_config(section_name=None, defaults=None):
+ """
+ Attempt to get a test config dictionary.
+
+ :param section_name: the section to read (all sections if not defined)
+ :param defaults: an optional dictionary namespace of defaults
+ """
+ config_file = os.environ.get('SWIFT_TEST_CONFIG_FILE',
+ '/etc/swift/test.conf')
+ config = {}
+ if defaults is not None:
+ config.update(defaults)
+
+ try:
+ config = readconf(config_file, section_name)
+ except SystemExit:
+ if not os.path.exists(config_file):
+ print >>sys.stderr, \
+ 'Unable to read test config %s - file not found' \
+ % config_file
+ elif not os.access(config_file, os.R_OK):
+ print >>sys.stderr, \
+ 'Unable to read test config %s - permission denied' \
+ % config_file
+ else:
+ print >>sys.stderr, \
+ 'Unable to read test config %s - section %s not found' \
+ % (config_file, section_name)
+ return config