summaryrefslogtreecommitdiff
path: root/test/haketilo_test/__main__.py
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-02-17 16:31:42 +0100
committerWojtek Kosior <koszko@koszko.org>2022-02-17 16:34:56 +0100
commitee0a4a935a95a9472655f85a04e1323f3d328898 (patch)
tree2a2228b138be8979f19cca334a8802e33540acbe /test/haketilo_test/__main__.py
parent3e4bde861cdee3312e1d410dc08f67d8e7c9168c (diff)
downloadbrowser-extension-ee0a4a935a95a9472655f85a04e1323f3d328898.tar.gz
browser-extension-ee0a4a935a95a9472655f85a04e1323f3d328898.zip
automatically pick up a free port to run the HTTP proxy on
It is now possible to run multiple `make test` commands in parallel (e.g. testing abrowser and librewolf simultaneously after running `configure` for each of them in 2 different directories).
Diffstat (limited to 'test/haketilo_test/__main__.py')
-rw-r--r--test/haketilo_test/__main__.py14
1 files changed, 3 insertions, 11 deletions
diff --git a/test/haketilo_test/__main__.py b/test/haketilo_test/__main__.py
index 3664e8c..18ef5b5 100644
--- a/test/haketilo_test/__main__.py
+++ b/test/haketilo_test/__main__.py
@@ -40,7 +40,7 @@ from .extension_crafting import get_extension_base_url
def fail(msg, error_code):
print('Error:', msg)
- print('Usage:', sys.argv[0], '[--load-haketilo]', '[certificates_directory] [proxy_port]')
+ print('Usage:', sys.argv[0], '[--load-haketilo]', '[certificates_directory]')
sys.exit(error_code)
load_haketilo = False
@@ -55,16 +55,8 @@ certdir = Path(sys.argv[argv_idx]).resolve() if len(sys.argv) > argv_idx \
if not certdir.is_dir():
fail('selected certificate directory does not exist.', 2)
-argv_idx += 1
-
-port = sys.argv[argv_idx] if len(sys.argv) > argv_idx \
- else str(default_proxy_port)
-
-if not port.isnumeric():
- fail('port must be an integer.', 3)
-
-httpd = do_an_internet(certdir, int(port))
-driver = firefox_safe_mode(proxy_port=int(port))
+httpd = do_an_internet(certdir)
+driver = firefox_safe_mode(proxy_port=httpd.server_port)
if load_haketilo:
driver.install_addon(str(Path.cwd() / 'mozilla-build.zip'), temporary=True)