diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2018-05-02 08:48:32 -0400 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-05-30 03:37:46 +0000 |
commit | 202d27c5309f2b5a2c4cda4af2e9a1ec85e1e9ad (patch) | |
tree | 80434465328987f4bde5a57e16bbff76ccf9f555 /tests | |
parent | 7e72af7657973d508c179922bd29257ff8402bcd (diff) |
core/various: python3 compat, prepare for python2 -> python3
see https://review.gluster.org/#/c/19788/ and
https://review.gluster.org/#/c/19871/
Selected small fixes from 2to3 utility. Specifically apply, basestring,
funcattrs, idioms, numliterals, set_literal, types, urllib, zip
Note: these 2to3 fixes report no changes are necessary: exec, execfile,
exitfunc, filter, getcwdu, intern, itertools, metaclass, methodattrs, ne,
next, nonzero, operator, paren, raw_input, reduce, reload, renames, repr,
standarderror, sys_exc, throw, tuple_params, xreadlines.
Any 2to3 fixes not in the above two lists have more extensive changes
which will follow in separate patches.
most unicode changes suggested by 2to3 will need to be applied at the
same time as changing the shebangs from python2 to python3. Prashanth
notes that unicode strings in py2 need 'u' prefix; unicode strings in
py3 3.0, 3.1, and 3.2 a 'u' prefix will throw an error, but in py3 3.3+
it is legal (or just ignored). All Linux dists we care about have 3.3
or later so we can leave 'u' prefixes on unicode strings.
Change-Id: I49bba2f328b0ee24b9a8115a7183be979981563e
updates: #411
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/features/ipctest.py | 2 | ||||
-rwxr-xr-x | tests/utils/create-files.py | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/tests/features/ipctest.py b/tests/features/ipctest.py index a8de3936b27..4417493a0ae 100755 --- a/tests/features/ipctest.py +++ b/tests/features/ipctest.py @@ -23,7 +23,7 @@ if __name__ == "__main__": import sys try: - res = apply(do_ipc,sys.argv[1:3]) + res = do_ipc(*sys.argv[1:3]) print(res) except: print("IPC failed (volume not started?)") diff --git a/tests/utils/create-files.py b/tests/utils/create-files.py index 71f967f4fdb..594072a359a 100755 --- a/tests/utils/create-files.py +++ b/tests/utils/create-files.py @@ -51,7 +51,7 @@ def os_rd(src, size): def os_wr(dest, data): global timr st = time.time() - fd = os.open(dest, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0644) + fd = os.open(dest, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o644) os.write(fd, data) os.close(fd) ed = time.time() @@ -88,7 +88,7 @@ def create_txt_file(fil, size, mins, maxs, rand): else: data = os_rd("/etc/services", 512*1024) file_size = 0 - fd = os.open(fil, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0644) + fd = os.open(fil, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o644) while file_size < size: os.write(fd, data) file_size += 500*1024 @@ -323,9 +323,9 @@ def human2bytes(size): def bytes2human(byts): abbr = { - 1 << 30L: "GB", - 1 << 20L: "MB", - 1 << 10L: "KB", + 1 << 30: "GB", + 1 << 20: "MB", + 1 << 10: "KB", 1: "bytes" } if byts == 1: |