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
Hamza
erp5
Commits
bbd886cb
Commit
bbd886cb
authored
Nov 13, 2012
by
Ivan Tyagov
Committed by
Sebastien Robin
Jan 11, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nexedi ERP5 uses latest testnode code so we need to update our repo as
well.
parent
b1f078a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
69 deletions
+24
-69
product/ERP5Type/tests/runTestSuite.py
product/ERP5Type/tests/runTestSuite.py
+24
-69
No files found.
product/ERP5Type/tests/runTestSuite.py
View file @
bbd886cb
#!/usr/bin/env python2.6
#!/usr/bin/env python2.6
import
argparse
,
pprint
,
socket
,
sys
,
time
,
xmlrpclib
import
argparse
,
sys
from
DummyTaskDistributionTool
import
DummyTaskDistributionTool
from
erp5.util
import
taskdistribution
from
ERP5TypeTestSuite
import
ERP5TypeTestSuite
# XXX: below section is shared with erp5/util/testnode/testnode.py .
# XXX: This import is required, just to populate sys.modules['test_suite'].
# They are supposed to be merged into a common library/tool someday, until
# Even if it's not used in this file. Yuck.
# then please keep them synchronised.
import
ERP5TypeTestSuite
# Depending on used xmlrpc backend, different exceptions can be thrown.
SAFE_RPC_EXCEPTION_LIST
=
[
socket
.
error
,
xmlrpclib
.
ProtocolError
,
xmlrpclib
.
Fault
]
def
_parsingErrorHandler
(
data
,
_
):
parser
,
_
=
xmlrpclib
.
getparser
()
print
>>
sys
.
stderr
,
'Error parsing data:'
,
repr
(
data
)
if
xmlrpclib
.
ExpatParser
and
isinstance
(
parser
,
xmlrpclib
.
ExpatParser
):
taskdistribution
.
patchRPCParser
(
_parsingErrorHandler
)
SAFE_RPC_EXCEPTION_LIST
.
append
(
xmlrpclib
.
expat
.
ExpatError
)
else
:
print
>>
sys
.
stderr
,
'Warning: unhandled xmlrpclib parser %r, some '
\
'exceptions might get through safeRpcCall'
%
(
parser
,
)
SAFE_RPC_EXCEPTION_LIST
=
tuple
(
SAFE_RPC_EXCEPTION_LIST
)
parser_klass
=
parser
.
__class__
__original_feed
=
parser_klass
.
feed
def
verbose_feed
(
self
,
data
):
try
:
return
__original_feed
(
self
,
data
)
except
Exception
:
print
>>
sys
.
stderr
,
'Error parsing data:'
,
repr
(
data
)
raise
try
:
parser_klass
.
feed
=
verbose_feed
except
TypeError
:
print
>>
sys
.
stderr
,
'Warning: could not monkey-patch %r.feed to output '
\
'parsed data on error, debugging in case of error will be more '
\
'difficult'
%
(
parser_klass
,
)
del
parser
,
verbose_feed
,
parser_klass
,
_
def
makeSuite
(
node_quantity
=
None
,
test_suite
=
None
,
revision
=
None
,
def
makeSuite
(
node_quantity
=
None
,
test_suite
=
None
,
revision
=
None
,
db_list
=
None
,
**
kwargs
):
db_list
=
None
,
**
kwargs
):
...
@@ -56,23 +35,6 @@ def makeSuite(node_quantity=None, test_suite=None, revision=None,
...
@@ -56,23 +35,6 @@ def makeSuite(node_quantity=None, test_suite=None, revision=None,
**
kwargs
)
**
kwargs
)
return
suite
return
suite
def
safeRpcCall
(
function
,
*
args
):
retry
=
64
xmlrpc_arg_list
=
[]
for
argument
in
args
:
if
isinstance
(
argument
,
dict
):
argument
=
dict
([(
x
,
isinstance
(
y
,
str
)
and
xmlrpclib
.
Binary
(
y
)
or
y
)
\
for
(
x
,
y
)
in
argument
.
iteritems
()])
xmlrpc_arg_list
.
append
(
argument
)
while
True
:
try
:
return
function
(
*
xmlrpc_arg_list
)
except
SAFE_RPC_EXCEPTION_LIST
,
e
:
print
>>
sys
.
stderr
,
e
pprint
.
pprint
(
args
,
file
(
function
.
_Method__name
,
'w'
))
time
.
sleep
(
retry
)
retry
+=
retry
>>
1
def
main
():
def
main
():
parser
=
argparse
.
ArgumentParser
(
description
=
'Run a test suite.'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'Run a test suite.'
)
parser
.
add_argument
(
'--test_suite'
,
help
=
'The test suite name'
)
parser
.
add_argument
(
'--test_suite'
,
help
=
'The test suite name'
)
...
@@ -98,38 +60,31 @@ def main():
...
@@ -98,38 +60,31 @@ def main():
parser
.
add_argument
(
'--persistent_memcached_server_hostname'
,
default
=
None
)
parser
.
add_argument
(
'--persistent_memcached_server_hostname'
,
default
=
None
)
parser
.
add_argument
(
'--persistent_memcached_server_port'
,
default
=
None
)
parser
.
add_argument
(
'--persistent_memcached_server_port'
,
default
=
None
)
parser
.
add_argument
(
'--bt5_path'
,
default
=
None
)
parser
.
add_argument
(
'--bt5_path'
,
default
=
None
)
parser
.
add_argument
(
"--xvfb_bin"
,
default
=
None
)
parser
.
add_argument
(
"--firefox_bin"
,
default
=
None
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
if
args
.
bt5_path
is
not
None
:
if
args
.
bt5_path
is
not
None
:
sys
.
path
[
0
:
0
]
=
args
.
bt5_path
.
split
(
","
)
sys
.
path
[
0
:
0
]
=
args
.
bt5_path
.
split
(
","
)
if
args
.
master_url
is
not
None
:
master
=
taskdistribution
.
TaskDistributionTool
(
args
.
master_url
)
master_url
=
args
.
master_url
if
master_url
[
-
1
]
!=
'/'
:
master_url
+=
'/'
master
=
xmlrpclib
.
ServerProxy
(
"%s%s"
%
(
master_url
,
'portal_task_distribution'
),
allow_none
=
1
)
assert
master
.
getProtocolRevision
()
==
1
else
:
master
=
DummyTaskDistributionTool
()
test_suite_title
=
args
.
test_suite_title
or
args
.
test_suite
test_suite_title
=
args
.
test_suite_title
or
args
.
test_suite
revision
=
args
.
revision
revision
=
args
.
revision
suite
=
makeSuite
(
test_suite
=
args
.
test_suite
,
suite
=
makeSuite
(
test_suite
=
args
.
test_suite
,
node_quantity
=
args
.
node_quantity
,
node_quantity
=
args
.
node_quantity
,
revision
=
revision
,
revision
=
revision
,
db_list
=
args
.
db_list
,
db_list
=
args
.
db_list
,
bt5_path
=
args
.
bt5_path
)
bt5_path
=
args
.
bt5_path
,
test_result
=
safeRpcCall
(
master
.
createTestResult
,
firefox_bin
=
args
.
firefox_bin
,
args
.
test_suite
,
revision
,
suite
.
getTestList
(),
xvfb_bin
=
args
.
xvfb_bin
)
suite
.
allow_restart
,
test_suite_title
,
args
.
test_node_title
,
test_result
=
master
.
createTestResult
(
revision
,
suite
.
getTestList
(),
args
.
test_node_title
,
suite
.
allow_restart
,
test_suite_title
,
args
.
project_title
)
args
.
project_title
)
if
test_result
:
if
test_result
is
not
None
:
test_result_path
,
test_revision
=
test_result
assert
revision
==
test_result
.
revision
,
(
revision
,
test_result
.
revision
)
while
suite
.
acquire
():
while
suite
.
acquire
():
test
=
safeRpcCall
(
master
.
startUnitTest
,
test_result_path
,
test
=
test_result
.
start
(
suite
.
running
.
keys
())
suite
.
running
.
keys
())
if
test
is
not
None
:
if
test
:
suite
.
start
(
test
.
name
,
lambda
status_dict
,
__test
=
test
:
suite
.
start
(
test
[
1
],
lambda
status_dict
,
__test_path
=
test
[
0
]:
__test
.
stop
(
**
status_dict
))
safeRpcCall
(
master
.
stopUnitTest
,
__test_path
,
status_dict
))
elif
not
suite
.
running
:
elif
not
suite
.
running
:
break
break
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