summaryrefslogtreecommitdiffstats
path: root/Tools/iobench
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-09-06 12:36:55 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-09-06 12:36:55 (GMT)
commit92f87f7c49179e271e893898ec898f9908508313 (patch)
tree833b711f1ffbc9999dd2382c0c6ed343f0408413 /Tools/iobench
parent13b55291ac84d2fb74f93c286a0bd5673f439e38 (diff)
downloadcpython-92f87f7c49179e271e893898ec898f9908508313.zip
cpython-92f87f7c49179e271e893898ec898f9908508313.tar.gz
cpython-92f87f7c49179e271e893898ec898f9908508313.tar.bz2
Add an option to choose the IO module under test (allows to bench
e.g. the pure Python implementation in _pyio).
Diffstat (limited to 'Tools/iobench')
-rw-r--r--Tools/iobench/iobench.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Tools/iobench/iobench.py b/Tools/iobench/iobench.py
index 92b4ffa..b3bdd6a 100644
--- a/Tools/iobench/iobench.py
+++ b/Tools/iobench/iobench.py
@@ -427,6 +427,9 @@ def main():
action="store", dest="newlines", default='lf',
help="line endings for text tests "
"(one of: {lf (default), cr, crlf, all})")
+ parser.add_option("-m", "--io-module",
+ action="store", dest="io_module", default=None,
+ help="io module to test (default: builtin open())")
options, args = parser.parse_args()
if args:
parser.error("unexpected arguments")
@@ -451,6 +454,9 @@ def main():
if options.encoding:
TEXT_ENCODING = options.encoding
+ if options.io_module:
+ globals()['open'] = __import__(options.io_module, {}, {}, ['open']).open
+
prepare_files()
run_all_tests(test_options)