summaryrefslogtreecommitdiffstats
path: root/ufo/test/unit/common/test_utils.py
diff options
context:
space:
mode:
authorPeter Portante <peter.portante@redhat.com>2013-04-04 13:08:32 -0400
committerAnand Avati <avati@redhat.com>2013-04-05 11:20:37 -0700
commit6a7d28c0f8c107baf376eceb9fc05d9e80bf74e5 (patch)
tree05adcb9cfab21adca87401032df6222239ef74d5 /ufo/test/unit/common/test_utils.py
parenta56dca94c3b174637074be46e9a537ba0ca02c4b (diff)
object-storage: use tox for unit tests; fix em too
Add the ability to use tox for unit tests, since it helps us solve the problem of supporting multiple branches that require different versions of dependencies, and allows us to possibly support multiple versions of python in the future. Also fix the code to work with pre-grizzly environments, by not requiring the constraints backport. Also fixed the xattr support to work with both pyxattr and xattr modules. And fixed the ring tests to also work without a live /etc/swift directory. BUG: 948657 (https://bugzilla.redhat.com/show_bug.cgi?id=948657) Change-Id: I2be79c8ef8916bb6552ef957094f9186a963a068 Signed-off-by: Peter Portante <peter.portante@redhat.com> Reviewed-on: http://review.gluster.org/4781 Reviewed-by: Alex Wheeler <wheelear@gmail.com> Tested-by: Alex Wheeler <wheelear@gmail.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'ufo/test/unit/common/test_utils.py')
-rw-r--r--ufo/test/unit/common/test_utils.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/ufo/test/unit/common/test_utils.py b/ufo/test/unit/common/test_utils.py
index dd89bd5e4ef..92ce9aef30f 100644
--- a/ufo/test/unit/common/test_utils.py
+++ b/ufo/test/unit/common/test_utils.py
@@ -41,7 +41,7 @@ _xattr_rem_err = {}
def _xkey(path, key):
return "%s:%s" % (path, key)
-def _setxattr(path, key, value):
+def _setxattr(path, key, value, *args, **kwargs):
_xattr_op_cnt['set'] += 1
xkey = _xkey(path, key)
if xkey in _xattr_set_err:
@@ -51,7 +51,7 @@ def _setxattr(path, key, value):
global _xattrs
_xattrs[xkey] = value
-def _getxattr(path, key):
+def _getxattr(path, key, *args, **kwargs):
_xattr_op_cnt['get'] += 1
xkey = _xkey(path, key)
if xkey in _xattr_get_err:
@@ -67,7 +67,7 @@ def _getxattr(path, key):
raise e
return ret_val
-def _removexattr(path, key):
+def _removexattr(path, key, *args, **kwargs):
_xattr_op_cnt['remove'] += 1
xkey = _xkey(path, key)
if xkey in _xattr_rem_err:
@@ -93,20 +93,20 @@ def _initxattr():
_xattr_rem_err = {}
# Save the current methods
- global _xattr_set; _xattr_set = xattr.set
- global _xattr_get; _xattr_get = xattr.get
- global _xattr_remove; _xattr_remove = xattr.remove
+ global _xattr_set; _xattr_set = xattr.setxattr
+ global _xattr_get; _xattr_get = xattr.getxattr
+ global _xattr_remove; _xattr_remove = xattr.removexattr
# Monkey patch the calls we use with our internal unit test versions
- xattr.set = _setxattr
- xattr.get = _getxattr
- xattr.remove = _removexattr
+ xattr.setxattr = _setxattr
+ xattr.getxattr = _getxattr
+ xattr.removexattr = _removexattr
def _destroyxattr():
# Restore the current methods just in case
- global _xattr_set; xattr.set = _xattr_set
- global _xattr_get; xattr.get = _xattr_get
- global _xattr_remove; xattr.remove = _xattr_remove
+ global _xattr_set; xattr.setxattr = _xattr_set
+ global _xattr_get; xattr.getxattr = _xattr_get
+ global _xattr_remove; xattr.removexattr = _xattr_remove
# Destroy the stored values and
global _xattrs; _xattrs = None