Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Nicolas Wavrant
slapos.core
Commits
0dfdde08
Commit
0dfdde08
authored
Aug 11, 2011
by
Antoine Catton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding time.sleep mocking functionnality
parent
017fc545
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
slapos/tests/slapgrid.py
slapos/tests/slapgrid.py
+16
-1
No files found.
slapos/tests/slapgrid.py
View file @
0dfdde08
...
@@ -79,6 +79,20 @@ class MasterMixin(BasicMixin):
...
@@ -79,6 +79,20 @@ class MasterMixin(BasicMixin):
setattr
(
httplib
,
name
,
original_value
)
setattr
(
httplib
,
name
,
original_value
)
del
self
.
saved_httplib
del
self
.
saved_httplib
def
_mock_sleep
(
self
):
self
.
fake_waiting_time
=
None
self
.
real_sleep
=
time
.
sleep
def
mocked_sleep
(
secs
):
if
self
.
fake_waiting_time
is
not
None
:
secs
=
self
.
fake_waiting_time
self
.
real_sleep
(
secs
)
time
.
sleep
=
mocked_sleep
def
_unmock_sleep
(
self
):
time
.
sleep
=
self
.
real_sleep
def
_create_instance
(
self
,
name
=
0
):
def
_create_instance
(
self
,
name
=
0
):
if
not
os
.
path
.
isdir
(
self
.
instance_root
):
if
not
os
.
path
.
isdir
(
self
.
instance_root
):
...
@@ -104,10 +118,12 @@ touch worked""")
...
@@ -104,10 +118,12 @@ touch worked""")
def
setUp
(
self
):
def
setUp
(
self
):
self
.
_patchHttplib
()
self
.
_patchHttplib
()
self
.
_mock_sleep
()
BasicMixin
.
setUp
(
self
)
BasicMixin
.
setUp
(
self
)
def
tearDown
(
self
):
def
tearDown
(
self
):
self
.
_unpatchHttplib
()
self
.
_unpatchHttplib
()
self
.
_unmock_sleep
()
BasicMixin
.
tearDown
(
self
)
BasicMixin
.
tearDown
(
self
)
class
TestSlapgridCPWithMaster
(
MasterMixin
,
unittest
.
TestCase
):
class
TestSlapgridCPWithMaster
(
MasterMixin
,
unittest
.
TestCase
):
...
@@ -521,4 +537,3 @@ exit 0""")
...
@@ -521,4 +537,3 @@ exit 0""")
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertFalse
(
self
.
error
)
self
.
assertFalse
(
self
.
error
)
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