Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f670ca5e
Commit
f670ca5e
authored
Feb 16, 2012
by
Charles-François Natali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #13878: Fix random test_sched failures.
parent
a124a688
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
Lib/test/test_sched.py
Lib/test/test_sched.py
+9
-8
No files found.
Lib/test/test_sched.py
View file @
f670ca5e
...
...
@@ -12,10 +12,10 @@ class TestCase(unittest.TestCase):
l
=
[]
fun
=
lambda
x
:
l
.
append
(
x
)
scheduler
=
sched
.
scheduler
(
time
.
time
,
time
.
sleep
)
for
x
in
[
0.
05
,
0.04
,
0.03
,
0.02
,
0.0
1
]:
for
x
in
[
0.
5
,
0.4
,
0.3
,
0.2
,
0.
1
]:
z
=
scheduler
.
enter
(
x
,
1
,
fun
,
(
x
,))
scheduler
.
run
()
self
.
assertEqual
(
l
,
[
0.
01
,
0.02
,
0.03
,
0.04
,
0.0
5
])
self
.
assertEqual
(
l
,
[
0.
1
,
0.2
,
0.3
,
0.4
,
0.
5
])
def
test_enterabs
(
self
):
l
=
[]
...
...
@@ -31,7 +31,7 @@ class TestCase(unittest.TestCase):
fun
=
lambda
x
:
l
.
append
(
x
)
scheduler
=
sched
.
scheduler
(
time
.
time
,
time
.
sleep
)
for
priority
in
[
1
,
2
,
3
,
4
,
5
]:
z
=
scheduler
.
enter
(
0.01
,
priority
,
fun
,
(
priority
,))
z
=
scheduler
.
enter
abs
(
0.01
,
priority
,
fun
,
(
priority
,))
scheduler
.
run
()
self
.
assertEqual
(
l
,
[
1
,
2
,
3
,
4
,
5
])
...
...
@@ -39,11 +39,12 @@ class TestCase(unittest.TestCase):
l
=
[]
fun
=
lambda
x
:
l
.
append
(
x
)
scheduler
=
sched
.
scheduler
(
time
.
time
,
time
.
sleep
)
event1
=
scheduler
.
enter
(
0.01
,
1
,
fun
,
(
0.01
,))
event2
=
scheduler
.
enter
(
0.02
,
1
,
fun
,
(
0.02
,))
event3
=
scheduler
.
enter
(
0.03
,
1
,
fun
,
(
0.03
,))
event4
=
scheduler
.
enter
(
0.04
,
1
,
fun
,
(
0.04
,))
event5
=
scheduler
.
enter
(
0.05
,
1
,
fun
,
(
0.05
,))
now
=
time
.
time
()
event1
=
scheduler
.
enterabs
(
now
+
0.01
,
1
,
fun
,
(
0.01
,))
event2
=
scheduler
.
enterabs
(
now
+
0.02
,
1
,
fun
,
(
0.02
,))
event3
=
scheduler
.
enterabs
(
now
+
0.03
,
1
,
fun
,
(
0.03
,))
event4
=
scheduler
.
enterabs
(
now
+
0.04
,
1
,
fun
,
(
0.04
,))
event5
=
scheduler
.
enterabs
(
now
+
0.05
,
1
,
fun
,
(
0.05
,))
scheduler
.
cancel
(
event1
)
scheduler
.
cancel
(
event5
)
scheduler
.
run
()
...
...
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