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
6ff3e37a
Commit
6ff3e37a
authored
Jan 26, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #11578: Backported test for the timeit module.
parent
a43a9e72
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
314 additions
and
3 deletions
+314
-3
Lib/test/test_sundry.py
Lib/test/test_sundry.py
+0
-1
Lib/test/test_timeit.py
Lib/test/test_timeit.py
+304
-0
Lib/timeit.py
Lib/timeit.py
+8
-2
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/test/test_sundry.py
View file @
6ff3e37a
...
@@ -71,7 +71,6 @@ class TestUntestedModules(unittest.TestCase):
...
@@ -71,7 +71,6 @@ class TestUntestedModules(unittest.TestCase):
import
sunaudio
import
sunaudio
import
symbol
import
symbol
import
tabnanny
import
tabnanny
import
timeit
import
toaiff
import
toaiff
import
token
import
token
try
:
try
:
...
...
Lib/test/test_timeit.py
0 → 100644
View file @
6ff3e37a
This diff is collapsed.
Click to expand it.
Lib/timeit.py
View file @
6ff3e37a
...
@@ -234,10 +234,10 @@ def repeat(stmt="pass", setup="pass", timer=default_timer,
...
@@ -234,10 +234,10 @@ def repeat(stmt="pass", setup="pass", timer=default_timer,
"""Convenience function to create Timer object and call repeat method."""
"""Convenience function to create Timer object and call repeat method."""
return
Timer
(
stmt
,
setup
,
timer
).
repeat
(
repeat
,
number
)
return
Timer
(
stmt
,
setup
,
timer
).
repeat
(
repeat
,
number
)
def
main
(
args
=
None
):
def
main
(
args
=
None
,
_wrap_timer
=
None
):
"""Main program, used when run as a script.
"""Main program, used when run as a script.
The optional argument specifies the command line to be parsed,
The optional
'args'
argument specifies the command line to be parsed,
defaulting to sys.argv[1:].
defaulting to sys.argv[1:].
The return value is an exit code to be passed to sys.exit(); it
The return value is an exit code to be passed to sys.exit(); it
...
@@ -246,6 +246,10 @@ def main(args=None):
...
@@ -246,6 +246,10 @@ def main(args=None):
When an exception happens during timing, a traceback is printed to
When an exception happens during timing, a traceback is printed to
stderr and the return value is 1. Exceptions at other times
stderr and the return value is 1. Exceptions at other times
(including the template compilation) are not caught.
(including the template compilation) are not caught.
'_wrap_timer' is an internal interface used for unit testing. If it
is not None, it must be a callable that accepts a timer function
and returns another timer function (used for unit testing).
"""
"""
if
args
is
None
:
if
args
is
None
:
args
=
sys
.
argv
[
1
:]
args
=
sys
.
argv
[
1
:]
...
@@ -291,6 +295,8 @@ def main(args=None):
...
@@ -291,6 +295,8 @@ def main(args=None):
# directory)
# directory)
import
os
import
os
sys
.
path
.
insert
(
0
,
os
.
curdir
)
sys
.
path
.
insert
(
0
,
os
.
curdir
)
if
_wrap_timer
is
not
None
:
timer
=
_wrap_timer
(
timer
)
t
=
Timer
(
stmt
,
setup
,
timer
)
t
=
Timer
(
stmt
,
setup
,
timer
)
if
number
==
0
:
if
number
==
0
:
# determine number so that 0.2 <= total time < 2.0
# determine number so that 0.2 <= total time < 2.0
...
...
Misc/NEWS
View file @
6ff3e37a
...
@@ -83,6 +83,8 @@ Tools/Demos
...
@@ -83,6 +83,8 @@ Tools/Demos
Tests
Tests
-----
-----
-
Issue
#
11578
:
Backported
test
for
the
timeit
module
.
-
Issue
#
22943
:
bsddb
tests
are
locale
independend
now
.
-
Issue
#
22943
:
bsddb
tests
are
locale
independend
now
.
IDLE
IDLE
...
...
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