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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
caab7974
Commit
caab7974
authored
May 13, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testERP5TestNode: use mock to not isolate monkey patches
we don't want to patch spawn for all tests
parent
92f3adb8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
37 deletions
+37
-37
erp5/tests/testERP5TestNode.py
erp5/tests/testERP5TestNode.py
+37
-37
No files found.
erp5/tests/testERP5TestNode.py
View file @
caab7974
...
...
@@ -578,47 +578,47 @@ shared = true
call_parameter_list
.
append
(
args
)
test_node
=
self
.
getTestNode
()
test_node
.
process_manager
.
spawn
=
spawn
runner
=
test_type_registry
[
my_test_type
](
test_node
)
# Create and initialise/regenerate a nodetestsuite
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
self
.
updateNodeTestSuiteData
(
node_test_suite
)
node_test_suite
.
revision_list
=
(
'dummy'
,
(
0
,
''
)),
path
=
runner
.
getInstanceRoot
(
node_test_suite
)
+
'/a/bin/runTestSuite'
os
.
makedirs
(
os
.
path
.
dirname
(
path
))
os
.
close
(
os
.
open
(
path
,
os
.
O_CREAT
))
expected_parameter_list
=
[
path
,
'--master_url'
,
'http://foo.bar'
,
'--revision'
,
'dummy=0-'
,
'--test_suite'
,
'Foo'
,
'--test_suite_title'
,
'Foo-Test'
,
]
def
checkRunTestSuiteParameters
():
runner
.
runTestSuite
(
node_test_suite
,
"http://foo.bar"
)
self
.
assertEqual
(
list
(
call_parameter_list
.
pop
()),
expected_parameter_list
)
self
.
assertFalse
(
call_parameter_list
)
checkRunTestSuiteParameters
()
def
part
(
path
):
# in "bar" SR
path
=
test_node
.
config
[
'slapos_directory'
]
\
+
'/soft/37b51d194a7513e45b56f6524f2d51f2/parts/'
+
path
with
mock
.
patch
.
object
(
test_node
.
process_manager
,
'spawn'
,
side_effect
=
spawn
):
runner
=
test_type_registry
[
my_test_type
](
test_node
)
# Create and initialise/regenerate a nodetestsuite
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
self
.
updateNodeTestSuiteData
(
node_test_suite
)
node_test_suite
.
revision_list
=
(
'dummy'
,
(
0
,
''
)),
path
=
runner
.
getInstanceRoot
(
node_test_suite
)
+
'/a/bin/runTestSuite'
os
.
makedirs
(
os
.
path
.
dirname
(
path
))
os
.
close
(
os
.
open
(
path
,
os
.
O_CREAT
))
return
path
for
option
in
(
(
'--firefox_bin'
,
part
(
'firefox/firefox-slapos'
)),
(
'--frontend_url'
,
'http://frontend/'
),
(
'--node_quantity'
,
'3'
),
(
'--xvfb_bin'
,
part
(
'xserver/bin/Xvfb'
)),
(
'--shared_part_list'
,
"/not/exists:/not/exists_either:%s/shared"
%
node_test_suite
.
working_directory
),
):
parser
.
add_argument
(
option
[
0
])
expected_parameter_list
+=
option
expected_parameter_list
=
[
path
,
'--master_url'
,
'http://foo.bar'
,
'--revision'
,
'dummy=0-'
,
'--test_suite'
,
'Foo'
,
'--test_suite_title'
,
'Foo-Test'
,
]
def
checkRunTestSuiteParameters
():
runner
.
runTestSuite
(
node_test_suite
,
"http://foo.bar"
)
self
.
assertEqual
(
list
(
call_parameter_list
.
pop
()),
expected_parameter_list
)
self
.
assertFalse
(
call_parameter_list
)
checkRunTestSuiteParameters
()
def
part
(
path
):
# in "bar" SR
path
=
test_node
.
config
[
'slapos_directory'
]
\
+
'/soft/37b51d194a7513e45b56f6524f2d51f2/parts/'
+
path
os
.
makedirs
(
os
.
path
.
dirname
(
path
))
os
.
close
(
os
.
open
(
path
,
os
.
O_CREAT
))
return
path
for
option
in
(
(
'--firefox_bin'
,
part
(
'firefox/firefox-slapos'
)),
(
'--frontend_url'
,
'http://frontend/'
),
(
'--node_quantity'
,
'3'
),
(
'--xvfb_bin'
,
part
(
'xserver/bin/Xvfb'
)),
(
'--shared_part_list'
,
"/not/exists:/not/exists_either:%s/shared"
%
node_test_suite
.
working_directory
),
):
parser
.
add_argument
(
option
[
0
])
expected_parameter_list
+=
option
checkRunTestSuiteParameters
()
def
test_10_prepareSlapOS
(
self
,
my_test_type
=
'UnitTest'
):
test_node
=
self
.
getTestNode
()
test_node_slapos
=
SlapOSInstance
(
self
.
slapos_directory
)
...
...
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