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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Papa Tamsir Kane
erp5
Commits
45b8bba6
Commit
45b8bba6
authored
Jul 04, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use erp5.tool.taskdistribution in runTestSuite.
parent
4e2fdaea
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
67 deletions
+18
-67
product/ERP5Type/tests/runTestSuite.py
product/ERP5Type/tests/runTestSuite.py
+18
-67
No files found.
product/ERP5Type/tests/runTestSuite.py
View file @
45b8bba6
#!/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'
)
...
@@ -102,16 +64,7 @@ def main():
...
@@ -102,16 +64,7 @@ def main():
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
,
...
@@ -119,17 +72,15 @@ def main():
...
@@ -119,17 +72,15 @@ def main():
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
,
test_result
=
master
.
createTestResult
(
revision
,
suite
.
getTestList
(),
args
.
test_suite
,
revision
,
suite
.
getTestList
(),
args
.
test_node_title
,
suite
.
allow_restart
,
test_suite_title
,
suite
.
allow_restart
,
test_suite_title
,
args
.
test_node_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