Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 92f87f7

Browse files
committed
Add an option to choose the IO module under test (allows to bench
e.g. the pure Python implementation in _pyio).
1 parent 13b5529 commit 92f87f7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Tools/iobench/iobench.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,9 @@ def main():
427427
action="store", dest="newlines", default='lf',
428428
help="line endings for text tests "
429429
"(one of: {lf (default), cr, crlf, all})")
430+
parser.add_option("-m", "--io-module",
431+
action="store", dest="io_module", default=None,
432+
help="io module to test (default: builtin open())")
430433
options, args = parser.parse_args()
431434
if args:
432435
parser.error("unexpected arguments")
@@ -451,6 +454,9 @@ def main():
451454
if options.encoding:
452455
TEXT_ENCODING = options.encoding
453456

457+
if options.io_module:
458+
globals()['open'] = __import__(options.io_module, {}, {}, ['open']).open
459+
454460
prepare_files()
455461
run_all_tests(test_options)
456462

0 commit comments

Comments
 (0)