summaryrefslogtreecommitdiff
blob: e20e45309e39770ea3295d65396b937af2b723f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
--- a/bindings/python/tests/test_copy.py
+++ b/bindings/python/tests/test_copy.py
@@ -61,15 +61,15 @@
 
 class TestProgressHandler(object):
   def begin(self, id, total, source, target):
-    print '+++ begin(): %d, total: %d' % (id, total)
-    print '+++ source: %s' % source
-    print '+++ target: %s' % target
+    print('+++ begin(): %d, total: %d' % (id, total))
+    print('+++ source: %s' % source)
+    print('+++ target: %s' % target)
 
   def end(self, jobId, status):
-    print '+++ end(): jobId: %s, status: %s'  % (jobId, status)
+    print('+++ end(): jobId: %s, status: %s'  % (jobId, status))
 
   def update(self, jobId, processed, total):
-    print '+++ update(): jobid: %s, processed: %d, total: %d' % (jobId, processed, total)
+    print('+++ update(): jobid: %s, processed: %d, total: %d' % (jobId, processed, total))
 
 def test_copy_progress_handler():
   c = client.CopyProcess()
--- a/bindings/python/tests/test_file.py
+++ b/bindings/python/tests/test_file.py
@@ -289,9 +289,9 @@
   for i, l in enumerate(lines):
     total += len(l)
     if l != pylines[i]:
-      print '!!!!!', total, i
-      print '+++++ py: %r' % pylines[i]
-      print '+++++ me: %r' % l
+      print('!!!!!', total, i)
+      print('+++++ py: %r' % pylines[i])
+      print('+++++ me: %r' % l)
       break
     if pylines[i].endswith('\n'):
       assert l.endswith('\n')
--- a/bindings/python/tests/test_filesystem.py
+++ b/bindings/python/tests/test_filesystem.py
@@ -37,20 +37,20 @@
   status, response = f.open(smallfile, OpenFlags.NEW)
 
   for func, args, hasReturnObject in funcspecs:
-      async(func, args, hasReturnObject)
+      run_async(func, args, hasReturnObject)
 
 def sync(func, args, hasReturnObject):
   status, response = func(*args)
-  print status
+  print(status)
   assert status.ok
   if hasReturnObject:
-      print response
+      print(response)
       assert response
 
-def async(func, args, hasReturnObject):
+def run_async(func, args, hasReturnObject):
   handler = AsyncResponseHandler()
   status = func(callback=handler, *args)
-  print status
+  print(status)
   assert status.ok
   status, response, hostlist = handler.wait()
 
@@ -60,7 +60,7 @@
 
   for host in hostlist:
     assert host.url
-    print host.url
+    print(host.url)
 
   if hasReturnObject:
     assert response
@@ -79,7 +79,7 @@
 
   try:
     os.remove('/tmp/eggs')
-  except OSError, __:
+  except OSError as __:
     pass
 
 def test_locate_sync():
@@ -127,7 +127,7 @@
 
   for item in response:
     assert item.name
-    print item.statinfo
+    print(item.statinfo)
     assert item.statinfo
     assert item.hostaddr
     
@@ -143,11 +143,11 @@
   assert status.ok
 
   for h in hostlist:
-    print h.url
+    print(h.url)
 
   for item in response:
     assert item.name
-    print item.statinfo
+    print(item.statinfo)
     assert item.statinfo
     assert item.hostaddr
 
@@ -158,7 +158,7 @@
   status, response = c.query(QueryCode.STATS, 'a')
   assert status.ok
   assert response
-  print response
+  print(response)
 
 def test_query_async():
   c = client.FileSystem(SERVER_URL)
@@ -169,7 +169,7 @@
   status, response, hostlist = handler.wait()
   assert status.ok
   assert response
-  print response
+  print(response)
   
 def test_mkdir_flags():
   c = client.FileSystem(SERVER_URL)
--- a/bindings/python/tests/test_glob.py
+++ b/bindings/python/tests/test_glob.py
@@ -2,7 +2,7 @@
 import os
 import glob as norm_glob
 import XRootD.client.glob_funcs as glob
-from pathlib2 import Path
+from pathlib import Path
 
 
 @pytest.fixture
@@ -13,7 +13,7 @@
     subdir2.mkdir()
     for i in range(3):
         dummy = subdir1 / ("a_file_%d.txt" % i)
-        dummy.write_text(u"This is file %d\n" % i, encoding="utf-8")
+        dummy.write_text("This is file %d\n" % i, encoding="utf-8")
     return tmpdir
 
 
--- a/bindings/python/tests/test_threads.py
+++ b/bindings/python/tests/test_threads.py
@@ -15,10 +15,10 @@
     s, _ = self.file.write(smallbuffer)
     assert s.ok
 
-    print '+++ thread %d says: %s' % (self.id, self.file.read())
+    print('+++ thread %d says: %s' % (self.id, self.file.read()))
 
     for line in self.file:
-      print '+++ thread %d says: %s' % (self.id, line)
+      print('+++ thread %d says: %s' % (self.id, line))
 
     self.file.close()
 
@@ -28,7 +28,7 @@
 #   assert f.is_open()
 #   f.write(smallbuffer)
 
-  for i in xrange(3):
+  for i in range(3):
     tt = TestThread(f, i)
     tt.start()
     tt.join()