summaryrefslogtreecommitdiff
path: root/subplot/ewww.py
diff options
context:
space:
mode:
Diffstat (limited to 'subplot/ewww.py')
-rw-r--r--subplot/ewww.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/subplot/ewww.py b/subplot/ewww.py
index 9282d64..43e5946 100644
--- a/subplot/ewww.py
+++ b/subplot/ewww.py
@@ -1,15 +1,11 @@
#############################################################################
# Some helpers to make step functions simpler.
-import json
import logging
import os
import random
-import re
import shutil
-import signal
import socket
-import subprocess
import time
import urllib.parse
@@ -18,6 +14,7 @@ import yaml
# Name of Rust binary, debug-build.
def _binary(name):
+ srcdir = globals()["srcdir"]
return os.path.abspath(os.path.join(srcdir, "target", "debug", name))
@@ -56,6 +53,7 @@ def create_file(ctx, filename=None, content=None):
# Copy test certificate from source tree, where it's been created previously by
# ./check.
def copy_test_certificate(ctx, cert=None, key=None):
+ srcdir = globals()["srcdir"]
logging.debug(f"Copying test.pem, test.key from srcdir to {cert} and {key}")
shutil.copy(os.path.join(srcdir, "test.pem"), cert)
shutil.copy(os.path.join(srcdir, "test.key"), key)
@@ -63,6 +61,8 @@ def copy_test_certificate(ctx, cert=None, key=None):
# Start server using named configuration file.
def start_server(ctx, filename=None):
+ get_file = globals()["get_file"]
+ start_daemon = globals()["start_daemon"]
logging.debug(f"Starting ewww with config file {filename}")
config = get_file(filename).decode("UTF-8")
config = yaml.safe_load(config)
@@ -95,12 +95,14 @@ def port_open(host, port, timeout):
# Stop previously started server.
def stop_server(ctx):
+ stop_daemon = globals()["stop_daemon"]
logging.debug("Stopping ewww")
stop_daemon(ctx, "ewww")
# Make an HTTP request.
def request(ctx, method=None, url=None):
+ http_request = globals()["http_request"]
logging.debug(f"Making HTTP request to ewww: {method} {url}")
url, host = _url(ctx, url)
http_request(ctx, host=host, method=method, url=url)