diff options
| author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2018-06-19 10:56:37 -0400 | 
|---|---|---|
| committer | Amar Tumballi <amarts@redhat.com> | 2018-06-21 05:45:08 +0000 | 
| commit | fe9b72485697a035b3dbb11b83048dd31de5863e (patch) | |
| tree | 8b265ee06edbe83c762d0124efd76cdcecebe1cf /tests | |
| parent | 2bab841316025c402b97c877ccc4ee9188c929e0 (diff) | |
core/various: python3 compat, prepare for python2 -> python3
see https://review.gluster.org/#/c/19788/,
    https://review.gluster.org/#/c/19871/,
    https://review.gluster.org/#/c/19952/,
    https://review.gluster.org/#/c/20104/,
    https://review.gluster.org/#/c/20162/,
    https://review.gluster.org/#/c/20185/,
    https://review.gluster.org/#/c/20207/,
    https://review.gluster.org/#/c/20227/, and
    https://review.gluster.org/#/c/20307/
This patch fixes more selected comma white space (ws_comma) as suggested
by the 2to3 utility.
Note: Fedora packaging guidelines and SUSE rpmlint require explicit
shebangs, so popular practices like #!/usr/bin/env python and
or #!/usr/bin/python3
Note: Selected small fixes from 2to3 utility. Specifically apply,
basestring, funcattrs, has_key, idioms, map, numliterals, raise,
set_literal, types, urllib, and zip have already been applied. Also
version agnostic imports for urllib, cpickle, socketserver, _thread,
queue, etc., suggested by Aravinda in https://review.gluster.org/#/c/19767/1
Note: these 2to3 fixes report no changes are necessary: asserts, buffer,
exec, execfile, exitfunc, filter, getcwdu, imports2, input, intern,
itertools, metaclass, methodattrs, ne, next, nonzero, operator, paren,
raw_input, reduce, reload, renames, repr, standarderror, sys_exc, throw,
tuple_params, xreadlines.
Change-Id: I60932030813484803f73733a9b2b7b23c7a843fd
updates: #411
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/bugs/distribute/overlap.py | 26 | ||||
| -rwxr-xr-x | tests/features/ipctest.py | 8 | ||||
| -rwxr-xr-x | tests/utils/gfid-access.py | 2 | ||||
| -rwxr-xr-x | tests/utils/setfattr.py | 2 | 
4 files changed, 19 insertions, 19 deletions
diff --git a/tests/bugs/distribute/overlap.py b/tests/bugs/distribute/overlap.py index 105aa6792cf..726389a78d6 100755 --- a/tests/bugs/distribute/overlap.py +++ b/tests/bugs/distribute/overlap.py @@ -4,15 +4,15 @@ from __future__ import print_function  import sys  def calculate_one (ov, nv): -    old_start = int(ov[18:26],16) -    old_end = int(ov[26:34],16) -    new_start = int(nv[18:26],16) -    new_end = int(nv[26:34],16) +    old_start = int(ov[18:26], 16) +    old_end = int(ov[26:34], 16) +    new_start = int(nv[18:26], 16) +    new_end = int(nv[26:34], 16)      if (new_end < old_start) or (new_start > old_end):          #print '%s, %s -> ZERO' % (ov, nv)          return 0 -    all_start = max(old_start,new_start) -    all_end = min(old_end,new_end) +    all_start = max(old_start, new_start) +    all_end = min(old_end, new_end)      #print '%s, %s -> %08x' % (ov, nv, all_end - all_start + 1)      return all_end - all_start + 1 @@ -22,7 +22,7 @@ def calculate_all (values):      for old_val in values[:nv_index]:          new_val = values[nv_index]          nv_index += 1 -        total += calculate_one(old_val,new_val) +        total += calculate_one(old_val, new_val)      return total  """ @@ -45,13 +45,13 @@ test2_vals = [      '0x000000000000000055555555aaaaaaa9',   # second third  ] -print '%08x' % calculate_one(test1_vals[0],test1_vals[3]) -print '%08x' % calculate_one(test1_vals[1],test1_vals[4]) -print '%08x' % calculate_one(test1_vals[2],test1_vals[5]) +print '%08x' % calculate_one(test1_vals[0], test1_vals[3]) +print '%08x' % calculate_one(test1_vals[1], test1_vals[4]) +print '%08x' % calculate_one(test1_vals[2], test1_vals[5])  print '= %08x' % calculate_all(test1_vals) -print '%08x' % calculate_one(test2_vals[0],test2_vals[3]) -print '%08x' % calculate_one(test2_vals[1],test2_vals[4]) -print '%08x' % calculate_one(test2_vals[2],test2_vals[5]) +print '%08x' % calculate_one(test2_vals[0], test2_vals[3]) +print '%08x' % calculate_one(test2_vals[1], test2_vals[4]) +print '%08x' % calculate_one(test2_vals[2], test2_vals[5])  print '= %08x' % calculate_all(test2_vals)  """ diff --git a/tests/features/ipctest.py b/tests/features/ipctest.py index 4417493a0ae..b64d4f86895 100755 --- a/tests/features/ipctest.py +++ b/tests/features/ipctest.py @@ -3,18 +3,18 @@  from __future__ import print_function  import ctypes -api = ctypes.CDLL("libgfapi.so",mode=ctypes.RTLD_GLOBAL) +api = ctypes.CDLL("libgfapi.so", mode=ctypes.RTLD_GLOBAL)  api.glfs_ipc.argtypes = [ ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p, ctypes.c_void_p ]  api.glfs_ipc.restype = ctypes.c_int  def do_ipc (host, volume):  	fs = api.glfs_new(volume) -	#api.glfs_set_logging(fs,"/dev/stderr",7) -	api.glfs_set_volfile_server(fs,"tcp",host,24007) +	#api.glfs_set_logging(fs, "/dev/stderr", 7) +	api.glfs_set_volfile_server(fs, "tcp", host, 24007)  	api.glfs_init(fs) -	ret  = api.glfs_ipc(fs,1470369258,0,0) +	ret  = api.glfs_ipc(fs, 1470369258, 0, 0)  	api.glfs_fini(fs)  	return ret diff --git a/tests/utils/gfid-access.py b/tests/utils/gfid-access.py index 2a58bfebc4e..6d892a37b2e 100755 --- a/tests/utils/gfid-access.py +++ b/tests/utils/gfid-access.py @@ -64,7 +64,7 @@ if __name__ == '__main__':      ftype      = sys.argv[5]      uid        = int(sys.argv[6])      gid        = int(sys.argv[7]) -    perm       = int(sys.argv[8],8) +    perm       = int(sys.argv[8], 8)      os.chdir(mtpt)      if pargfid == 'ROOT': diff --git a/tests/utils/setfattr.py b/tests/utils/setfattr.py index 159218d8bef..9a7daeb1be4 100755 --- a/tests/utils/setfattr.py +++ b/tests/utils/setfattr.py @@ -46,7 +46,7 @@ if __name__ == '__main__':      parser.add_option("-x", action="store", dest="xname", type="string",                        help="Remove the named extended attribute entirely.") -    (option,args) = parser.parse_args() +    (option, args) = parser.parse_args()      if not args:          print ("Usage: setfattr {-n name} [-v value] file...")          print ("       setfattr {-x name} file...")  | 
