diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-07-07 14:06:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-07 14:06:58 (GMT) |
commit | 1881befb905553618f1e7ad2cef8f6ff07e1b8ef (patch) | |
tree | ba85da0904634fb569d5dd5217d53dbbb56807e6 /Lib/test | |
parent | fae8f4a9cb88a68eb14750cbb8ddf8740fd67b8b (diff) | |
download | cpython-1881befb905553618f1e7ad2cef8f6ff07e1b8ef.zip cpython-1881befb905553618f1e7ad2cef8f6ff07e1b8ef.tar.gz cpython-1881befb905553618f1e7ad2cef8f6ff07e1b8ef.tar.bz2 |
bpo-29854: test_readline logs versions (#2619)
* test_readline logs the versions of libreadline when run in verbose
mode
* Add also readline._READLINE_LIBRARY_VERSION
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_readline.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py index cc3001a..5c37286 100644 --- a/Lib/test/test_readline.py +++ b/Lib/test/test_readline.py @@ -9,13 +9,29 @@ import subprocess import sys import tempfile import unittest -from test.support import import_module, unlink, temp_dir, TESTFN +from test.support import import_module, unlink, temp_dir, TESTFN, verbose from test.support.script_helper import assert_python_ok # Skip tests if there is no readline module readline = import_module('readline') -is_editline = readline.__doc__ and "libedit" in readline.__doc__ +if hasattr(readline, "_READLINE_LIBRARY_VERSION"): + is_editline = ("EditLine wrapper" in readline._READLINE_LIBRARY_VERSION) +else: + is_editline = (readline.__doc__ and "libedit" in readline.__doc__) + + +def setUpModule(): + if verbose: + # Python implementations other than CPython may not have + # these private attributes + if hasattr(readline, "_READLINE_VERSION"): + print(f"readline version: {readline._READLINE_VERSION:#x}") + print(f"readline runtime version: {readline._READLINE_RUNTIME_VERSION:#x}") + if hasattr(readline, "_READLINE_LIBRARY_VERSION"): + print(f"readline library version: {readline._READLINE_LIBRARY_VERSION!r}") + print(f"use libedit emulation? {is_editline}") + @unittest.skipUnless(hasattr(readline, "clear_history"), "The history update test cannot be run because the " |