Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fslpy
Commits
e5fdadb1
Commit
e5fdadb1
authored
Apr 16, 2017
by
Paul McCarthy
Browse files
mutex unit test was broken
parent
b86f22b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_async.py
View file @
e5fdadb1
...
...
@@ -453,43 +453,34 @@ def test_mutex():
class
Thing
(
object
):
@
async
.
mutex
def
method1
(
self
):
self
.
method1start
=
time
.
time
()
time
.
sleep
(
0.5
)
self
.
method1end
=
time
.
time
()
@
async
.
mutex
def
method2
(
self
):
self
.
method2start
=
time
.
time
()
time
.
sleep
(
0.5
)
self
.
method2end
=
time
.
time
()
t
=
[
Thing
()]
times
=
{
'thread1start'
:
0
,
'thread1end'
:
0
,
'thread2start'
:
0
,
'thread2end'
:
0
,
}
def
thread1
():
times
[
'thread1start'
]
=
time
.
time
()
t
[
0
].
method1
()
times
[
'thread1end'
]
=
time
.
time
()
def
thread2
():
times
[
'thread2start'
]
=
time
.
time
()
t
[
0
].
method2
()
times
[
'thread2start'
]
=
time
.
time
()
for
i
in
range
(
10
):
times
=
{
'thread1start'
:
0
,
'thread1end'
:
0
,
'thread2start'
:
0
,
'thread2end'
:
0
,
}
for
i
in
range
(
20
):
t
[
0
].
method1start
=
None
t
[
0
].
method2start
=
None
t
[
0
].
method1end
=
None
t
[
0
].
method2end
=
None
t1
=
threading
.
Thread
(
target
=
thread1
)
t2
=
threading
.
Thread
(
target
=
thread2
)
...
...
@@ -498,4 +489,4 @@ def test_mutex():
t1
.
join
()
t2
.
join
()
assert
t
imes
[
'threa
d2start
'
]
>
t
imes
[
'threa
d1end
'
]
assert
t
[
0
].
metho
d2start
>
t
[
0
].
metho
d1end
Write
Preview
Supports
Markdown
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