From 4c933941e64ba2b4b5da3c19e5ed5924a30e0752 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Mon, 13 Dec 2021 14:10:55 +0100 Subject: enable in-line command editing in the Python prompt shown as part of `make test-environment` --- test/__main__.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/__main__.py b/test/__main__.py index c3437ea..bb971f2 100644 --- a/test/__main__.py +++ b/test/__main__.py @@ -30,6 +30,8 @@ Run a Firefox-type browser with WebDriver attached and Python console open import sys import time import code +from rlcompleter import Completer +import readline from .server import do_an_internet from .misc_constants import * @@ -53,6 +55,11 @@ driver = firefox_safe_mode(proxy_port=int(port)) print("You can now control the browser through 'driver' object") +# Here we enable readline-enhanced editing: +# https://stackoverflow.com/questions/35115208/is-there-any-way-to-combine-readline-rlcompleter-and-interactiveconsole-in-pytho#answer-35116399 +readline.parse_and_bind('tab: complete'); +console_locals = globals() +readline.set_completer(Completer(console_locals).complete) code.InteractiveConsole(locals=globals()).interact() driver.quit() -- cgit v1.2.3