Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Titouan Soulard
erp5
Commits
b7f35cdf
Commit
b7f35cdf
authored
Oct 02, 2022
by
Kazuhiko Shiozaki
Committed by
Arnaud Fontaine
Mar 08, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2/py3: use print() in product.
parent
c6d77a49
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
37 additions
and
34 deletions
+37
-34
product/ERP5/bin/bigfile_client_example.py
product/ERP5/bin/bigfile_client_example.py
+1
-1
product/ERP5/tests/erp5_url_checker.py
product/ERP5/tests/erp5_url_checker.py
+5
-5
product/ERP5/tests/testInvalidationBug.py
product/ERP5/tests/testInvalidationBug.py
+2
-2
product/ERP5/tests/testXHTML.py
product/ERP5/tests/testXHTML.py
+1
-1
product/ERP5OOo/tests/test_document/TEST-en-002.py
product/ERP5OOo/tests/test_document/TEST-en-002.py
+1
-1
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
+4
-4
product/ERP5Type/tests/_testPystone.py
product/ERP5Type/tests/_testPystone.py
+1
-1
product/ERP5Type/tests/_testSQLBench.py
product/ERP5Type/tests/_testSQLBench.py
+2
-2
product/ERP5Type/tests/runTestSuite.py
product/ERP5Type/tests/runTestSuite.py
+4
-3
product/ERP5Type/tests/runUnitTest.py
product/ERP5Type/tests/runUnitTest.py
+5
-4
product/PortalTransforms/tests/test_transforms.py
product/PortalTransforms/tests/test_transforms.py
+4
-3
product/Zelenium/scripts/tinyWebClient.py
product/Zelenium/scripts/tinyWebClient.py
+3
-3
product/Zelenium/scripts/tinyWebServer.py
product/Zelenium/scripts/tinyWebServer.py
+4
-4
No files found.
product/ERP5/bin/bigfile_client_example.py
View file @
b7f35cdf
...
@@ -22,7 +22,7 @@ result = connection.getresponse()
...
@@ -22,7 +22,7 @@ result = connection.getresponse()
path
=
result
.
getheader
(
"X-Document-Location"
)
path
=
result
.
getheader
(
"X-Document-Location"
)
result
.
close
()
result
.
close
()
path
=
'/%s'
%
'/'
.
join
(
path
.
split
(
'/'
)[
3
:])
path
=
'/%s'
%
'/'
.
join
(
path
.
split
(
'/'
)[
3
:])
print
path
print
(
path
)
######################################
######################################
# Upload chunks
# Upload chunks
...
...
product/ERP5/tests/erp5_url_checker.py
View file @
b7f35cdf
...
@@ -53,7 +53,7 @@ def main():
...
@@ -53,7 +53,7 @@ def main():
threads
[
len
(
threads
)
-
1
].
start
()
threads
[
len
(
threads
)
-
1
].
start
()
request_number
+=
1
request_number
+=
1
i
+=
1
i
+=
1
print
"thread: %i request: %i url: %s"
%
(
i
,
request_number
,
url
)
print
(
"thread: %i request: %i url: %s"
%
(
i
,
request_number
,
url
)
)
else
:
else
:
for
t
in
range
(
0
,
max_thread
):
for
t
in
range
(
0
,
max_thread
):
if
threads
[
t
].
isAlive
()
==
0
:
if
threads
[
t
].
isAlive
()
==
0
:
...
@@ -63,7 +63,7 @@ def main():
...
@@ -63,7 +63,7 @@ def main():
threads
[
t
].
start
()
threads
[
t
].
start
()
i
+=
1
i
+=
1
request_number
+=
1
request_number
+=
1
print
"thread: %i request: %i url: %s"
%
(
i
,
request_number
,
url
)
print
(
"thread: %i request: %i url: %s"
%
(
i
,
request_number
,
url
)
)
break
break
...
@@ -146,17 +146,17 @@ class Checker(URLOpener):
...
@@ -146,17 +146,17 @@ class Checker(URLOpener):
thread
.
start
()
thread
.
start
()
while
thread
.
isAlive
():
while
thread
.
isAlive
():
sleep
(
0.5
)
sleep
(
0.5
)
print
"Connection to %s went fine"
%
url
print
(
"Connection to %s went fine"
%
url
)
except
IOError
as
err
:
except
IOError
as
err
:
(
errno
,
strerror
)
=
err
.
args
(
errno
,
strerror
)
=
err
.
args
print
"Can't connect to %s because of I/O error(%s): %s"
%
(
url
,
errno
,
strerror
)
print
(
"Can't connect to %s because of I/O error(%s): %s"
%
(
url
,
errno
,
strerror
)
)
def
SearchUrl
(
self
,
url
=
None
):
def
SearchUrl
(
self
,
url
=
None
):
try
:
try
:
conn
=
self
.
open_http
(
url
)
conn
=
self
.
open_http
(
url
)
except
IOError
as
err
:
except
IOError
as
err
:
(
errno
,
strerror
)
=
err
.
args
(
errno
,
strerror
)
=
err
.
args
print
"Can't connect to %s because of I/O error(%s): %s"
%
(
url
,
errno
,
strerror
)
print
(
"Can't connect to %s because of I/O error(%s): %s"
%
(
url
,
errno
,
strerror
)
)
def
raise_error
(
self
,
error_key
,
field
):
def
raise_error
(
self
,
error_key
,
field
):
...
...
product/ERP5/tests/testInvalidationBug.py
View file @
b7f35cdf
...
@@ -188,8 +188,8 @@ class TestInvalidationBug(ERP5TypeTestCase):
...
@@ -188,8 +188,8 @@ class TestInvalidationBug(ERP5TypeTestCase):
module
.
setIdGenerator
(
'_generatePerDayId'
)
module
.
setIdGenerator
(
'_generatePerDayId'
)
#module.migrateToHBTree()
#module.migrateToHBTree()
self
.
tic
()
self
.
tic
()
print
'OID(%s) = %r'
%
(
module
.
getRelativeUrl
(),
module
.
_p_oid
)
print
(
'OID(%s) = %r'
%
(
module
.
getRelativeUrl
(),
module
.
_p_oid
)
)
print
' OID(_tree) = %r'
%
module
.
_tree
.
_p_oid
print
(
' OID(_tree) = %r'
%
module
.
_tree
.
_p_oid
)
previous
=
DateTime
()
previous
=
DateTime
()
skin_folder
=
self
.
getPortal
().
portal_skins
.
custom
skin_folder
=
self
.
getPortal
().
portal_skins
.
custom
if
'create_script'
in
skin_folder
.
objectIds
():
if
'create_script'
in
skin_folder
.
objectIds
():
...
...
product/ERP5/tests/testXHTML.py
View file @
b7f35cdf
...
@@ -748,7 +748,7 @@ if validator_to_use == 'tidy':
...
@@ -748,7 +748,7 @@ if validator_to_use == 'tidy':
warning
=
False
warning
=
False
validator_path
=
'/usr/bin/tidy'
validator_path
=
'/usr/bin/tidy'
if
not
os
.
path
.
exists
(
validator_path
):
if
not
os
.
path
.
exists
(
validator_path
):
print
'tidy is not installed at %s'
%
validator_path
print
(
'tidy is not installed at %s'
%
validator_path
)
else
:
else
:
validator
=
TidyValidator
(
validator_path
,
show_warnings
)
validator
=
TidyValidator
(
validator_path
,
show_warnings
)
...
...
product/ERP5OOo/tests/test_document/TEST-en-002.py
View file @
b7f35cdf
...
@@ -27,5 +27,5 @@
...
@@ -27,5 +27,5 @@
##############################################################################
##############################################################################
def
say_hello
():
def
say_hello
():
print
'hello'
print
(
'hello'
)
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
View file @
b7f35cdf
...
@@ -438,10 +438,10 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
...
@@ -438,10 +438,10 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
def
_verboseErrorLog
(
self
,
size
=
10
):
def
_verboseErrorLog
(
self
,
size
=
10
):
for
entry
in
self
.
portal
.
error_log
.
getLogEntries
()[:
size
]:
for
entry
in
self
.
portal
.
error_log
.
getLogEntries
()[:
size
]:
print
"="
*
20
print
((
"="
*
20
))
print
"ERROR ID : %s"
%
entry
[
"id"
]
print
((
"ERROR ID : %s"
%
entry
[
"id"
]))
print
"TRACEBACK :"
print
(
"TRACEBACK :"
)
print
entry
[
"tb_text"
]
print
((
entry
[
"tb_text"
]))
def
testFunctionalTestRunner
(
self
):
def
testFunctionalTestRunner
(
self
):
# Check the zuite page templates can be rendered, because selenium test
# Check the zuite page templates can be rendered, because selenium test
...
...
product/ERP5Type/tests/_testPystone.py
View file @
b7f35cdf
...
@@ -33,4 +33,4 @@ class TestPystone(unittest.TestCase):
...
@@ -33,4 +33,4 @@ class TestPystone(unittest.TestCase):
"""Tests to get pystone value
"""Tests to get pystone value
"""
"""
def
test_pystone
(
self
):
def
test_pystone
(
self
):
print
"PYSTONE RESULT (time,score) : %r"
%
(
pystone
.
pystones
(),
)
print
((
"PYSTONE RESULT (time,score) : %r"
%
(
pystone
.
pystones
(),))
)
product/ERP5Type/tests/_testSQLBench.py
View file @
b7f35cdf
...
@@ -55,11 +55,11 @@ class TestSQLBench(unittest.TestCase):
...
@@ -55,11 +55,11 @@ class TestSQLBench(unittest.TestCase):
sqlbench_path
+
'/test-alter-table'
,
sqlbench_path
+
'/test-alter-table'
,
'--database'
,
database
,
'--database'
,
database
,
'--host'
,
host
,
'--user'
,
user
,
'--password'
,
password
]
'--host'
,
host
,
'--user'
,
user
,
'--password'
,
password
]
print
command_list
print
(
command_list
)
process
=
subprocess
.
Popen
(
command_list
,
process
=
subprocess
.
Popen
(
command_list
,
cwd
=
sqlbench_path
,
cwd
=
sqlbench_path
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
output
,
error
=
process
.
communicate
()
output
,
error
=
process
.
communicate
()
self
.
assertEqual
(
0
,
len
(
error
),
error
)
self
.
assertEqual
(
0
,
len
(
error
),
error
)
print
output
print
(
output
)
self
.
assertTrue
(
output
.
find
(
"Total time: "
)
>=
0
)
self
.
assertTrue
(
output
.
find
(
"Total time: "
)
>=
0
)
product/ERP5Type/tests/runTestSuite.py
View file @
b7f35cdf
#!/usr/bin/env python2.7
#!/usr/bin/env python2.7
from
__future__
import
absolute_import
from
__future__
import
absolute_import
from
__future__
import
print_function
# six.PY2
import
argparse
,
sys
,
os
,
textwrap
import
argparse
,
sys
,
os
,
textwrap
from
erp5.util
import
taskdistribution
from
erp5.util
import
taskdistribution
...
@@ -8,7 +9,7 @@ from erp5.util import taskdistribution
...
@@ -8,7 +9,7 @@ from erp5.util import taskdistribution
from
.
import
ERP5TypeTestSuite
from
.
import
ERP5TypeTestSuite
def
_parsingErrorHandler
(
data
,
_
):
def
_parsingErrorHandler
(
data
,
_
):
print
>>
sys
.
stderr
,
'Error parsing data:'
,
repr
(
data
)
print
(
'Error parsing data:'
,
repr
(
data
),
file
=
sys
.
stderr
)
taskdistribution
.
patchRPCParser
(
_parsingErrorHandler
)
taskdistribution
.
patchRPCParser
(
_parsingErrorHandler
)
def
makeSuite
(
def
makeSuite
(
...
@@ -119,8 +120,8 @@ def main():
...
@@ -119,8 +120,8 @@ def main():
args
.
zserver_frontend_url_list
.
split
(
','
)
if
args
.
zserver_frontend_url_list
else
())
args
.
zserver_frontend_url_list
.
split
(
','
)
if
args
.
zserver_frontend_url_list
else
())
if
args
.
zserver_address_list
and
len
(
args
.
zserver_address_list
)
<
args
.
node_quantity
:
if
args
.
zserver_address_list
and
len
(
args
.
zserver_address_list
)
<
args
.
node_quantity
:
print
>>
sys
.
stderr
,
'Not enough zserver address/frontends for node quantity %s (%r)'
%
(
print
(
'Not enough zserver address/frontends for node quantity %s (%r)'
%
(
args
.
node_quantity
,
args
.
zserver_address_list
)
args
.
node_quantity
,
args
.
zserver_address_list
)
,
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
# sanity check
# sanity check
...
...
product/ERP5Type/tests/runUnitTest.py
View file @
b7f35cdf
#!/usr/bin/env python2.7
#!/usr/bin/env python2.7
from
__future__
import
print_function
# six.PY2
import
os
import
os
import
sys
import
sys
import
pdb
import
pdb
...
@@ -691,7 +692,7 @@ def runUnitTestList(test_list, verbosity=1, debug=0, run_only=None):
...
@@ -691,7 +692,7 @@ def runUnitTestList(test_list, verbosity=1, debug=0, run_only=None):
transaction
.
commit
()
transaction
.
commit
()
except
:
except
:
import
traceback
import
traceback
print
"runUnitTestList Exception : %r"
%
(
traceback
.
print_exc
(),
)
print
(
"runUnitTestList Exception : %r"
%
(
traceback
.
print_exc
(),)
)
# finally does not expect opened transaction, even in the
# finally does not expect opened transaction, even in the
# case of a Ctrl-C.
# case of a Ctrl-C.
transaction
.
abort
()
transaction
.
abort
()
...
@@ -725,10 +726,10 @@ def runUnitTestList(test_list, verbosity=1, debug=0, run_only=None):
...
@@ -725,10 +726,10 @@ def runUnitTestList(test_list, verbosity=1, debug=0, run_only=None):
def
usage
(
stream
,
msg
=
None
):
def
usage
(
stream
,
msg
=
None
):
if
msg
:
if
msg
:
print
>>
stream
,
msg
print
(
msg
,
file
=
stream
)
print
>>
stream
print
(
file
=
stream
)
program
=
os
.
path
.
basename
(
sys
.
argv
[
0
])
program
=
os
.
path
.
basename
(
sys
.
argv
[
0
])
print
>>
stream
,
__doc__
%
{
"program"
:
program
}
print
(
__doc__
%
{
"program"
:
program
},
file
=
stream
)
log_directory
=
None
log_directory
=
None
def
main
(
argument_list
=
None
):
def
main
(
argument_list
=
None
):
...
...
product/PortalTransforms/tests/test_transforms.py
View file @
b7f35cdf
from
__future__
import
absolute_import
from
__future__
import
absolute_import
from
__future__
import
print_function
# six.PY2
import
os
import
os
import
logging
import
logging
from
Products.Archetypes.tests.atsitetestcase
import
ATSiteTestCase
from
Products.Archetypes.tests.atsitetestcase
import
ATSiteTestCase
...
@@ -44,8 +45,8 @@ class TransformTest(ATSiteTestCase):
...
@@ -44,8 +45,8 @@ class TransformTest(ATSiteTestCase):
output
=
open
(
output
)
output
=
open
(
output
)
except
IOError
:
except
IOError
:
import
sys
import
sys
print
>>
sys
.
stderr
,
'No output file found.'
print
(
'No output file found.'
,
file
=
sys
.
stderr
)
print
>>
sys
.
stderr
,
'File %s created, check it !'
%
self
.
output
print
(
'File %s created, check it !'
%
self
.
output
,
file
=
sys
.
stderr
)
output
=
open
(
output
,
'w'
)
output
=
open
(
output
,
'w'
)
output
.
write
(
got
)
output
.
write
(
got
)
output
.
close
()
output
.
close
()
...
@@ -238,7 +239,7 @@ def make_tests(test_descr=TRANSFORMS_TESTINFO):
...
@@ -238,7 +239,7 @@ def make_tests(test_descr=TRANSFORMS_TESTINFO):
continue
continue
if
TR_NAMES
is
not
None
and
not
_transform
.
name
()
in
TR_NAMES
:
if
TR_NAMES
is
not
None
and
not
_transform
.
name
()
in
TR_NAMES
:
print
'skip test for'
,
_transform
.
name
(
)
print
(
'skip test for'
,
_transform
.
name
()
)
continue
continue
class
TransformTestSubclass
(
TransformTest
):
class
TransformTestSubclass
(
TransformTest
):
...
...
product/Zelenium/scripts/tinyWebClient.py
View file @
b7f35cdf
...
@@ -2,7 +2,7 @@ import sys
...
@@ -2,7 +2,7 @@ import sys
import
httplib
import
httplib
if
(
len
(
sys
.
argv
)
!=
5
):
if
(
len
(
sys
.
argv
)
!=
5
):
print
"usage tinyWebClient.py host port method path"
print
(
"usage tinyWebClient.py host port method path"
)
else
:
else
:
host
=
sys
.
argv
[
1
]
host
=
sys
.
argv
[
1
]
port
=
sys
.
argv
[
2
]
port
=
sys
.
argv
[
2
]
...
@@ -10,7 +10,7 @@ else:
...
@@ -10,7 +10,7 @@ else:
path
=
sys
.
argv
[
4
]
path
=
sys
.
argv
[
4
]
info
=
(
host
,
port
)
info
=
(
host
,
port
)
print
"%s:%s"
%
info
print
(
"%s:%s"
%
info
)
conn
=
httplib
.
HTTPConnection
(
"%s:%s"
%
info
)
conn
=
httplib
.
HTTPConnection
(
"%s:%s"
%
info
)
conn
.
request
(
method
,
path
)
conn
.
request
(
method
,
path
)
print
conn
.
getresponse
().
msg
print
(
conn
.
getresponse
().
msg
)
product/Zelenium/scripts/tinyWebServer.py
View file @
b7f35cdf
...
@@ -62,12 +62,12 @@ if __name__ == '__main__':
...
@@ -62,12 +62,12 @@ if __name__ == '__main__':
server_address
=
(
''
,
port
)
server_address
=
(
''
,
port
)
httpd
=
BaseHTTPServer
.
HTTPServer
(
server_address
,
HTTPHandler
)
httpd
=
BaseHTTPServer
.
HTTPServer
(
server_address
,
HTTPHandler
)
print
"serving at port"
,
port
print
(
"serving at port"
,
port
)
print
"To run the entire JsUnit test suite, open"
print
(
"To run the entire JsUnit test suite, open"
)
print
(
" http://localhost:8000/jsunit/testRunner.html?testPage="
print
(
" http://localhost:8000/jsunit/testRunner.html?testPage="
"http://localhost:8000/tests/JsUnitSuite.html&autoRun=true"
)
"http://localhost:8000/tests/JsUnitSuite.html&autoRun=true"
)
print
"To run the acceptance test suite, open"
print
(
"To run the acceptance test suite, open"
)
print
" http://localhost:8000/TestRunner.html"
print
(
" http://localhost:8000/TestRunner.html"
)
while
not
HTTPHandler
.
quitRequestReceived
:
while
not
HTTPHandler
.
quitRequestReceived
:
httpd
.
handle_request
()
httpd
.
handle_request
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment