aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2021-12-13 14:10:55 +0100
committerWojtek Kosior <koszko@koszko.org>2021-12-13 14:10:55 +0100
commit4c933941e64ba2b4b5da3c19e5ed5924a30e0752 (patch)
treec541a10516d793a9ea747eade73ccef2dc50e05d /test
parent1e4ce148c54a16c96e273090d5ff03b2a4789469 (diff)
downloadbrowser-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__.py7
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()