diff options
author | Wojtek Kosior <koszko@koszko.org> | 2021-12-13 14:10:55 +0100 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2021-12-13 14:10:55 +0100 |
commit | 4c933941e64ba2b4b5da3c19e5ed5924a30e0752 (patch) | |
tree | c541a10516d793a9ea747eade73ccef2dc50e05d /test | |
parent | 1e4ce148c54a16c96e273090d5ff03b2a4789469 (diff) | |
download | browser-extension-4c933941e64ba2b4b5da3c19e5ed5924a30e0752.tar.gz browser-extension-4c933941e64ba2b4b5da3c19e5ed5924a30e0752.zip |
enable in-line command editing in the Python prompt shown as part of `make test-environment`
Diffstat (limited to 'test')
-rw-r--r-- | test/__main__.py | 7 |
1 files changed, 7 insertions, 0 deletions
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() |