diff options
author | Rouven Czerwinski <rouven@czerwinskis.de> | 2020-03-27 08:25:07 +0100 |
---|---|---|
committer | Jon <jonringer@users.noreply.github.com> | 2020-03-27 01:57:48 -0700 |
commit | 1685cd7fa7c6e5a89990f8937c4fa43ff76af779 (patch) | |
tree | fc9f625d4b316c5ec4bfdf29c692c57c6b714e71 /nixos/lib | |
parent | 279438e7f87c235600c1327dc25c8d18b5a0d437 (diff) |
nixos/test: update test-driver.py for mypy 0.770
Diffstat (limited to 'nixos/lib')
-rw-r--r-- | nixos/lib/test-driver/test-driver.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/lib/test-driver/test-driver.py b/nixos/lib/test-driver/test-driver.py index c27947bc610d..7825025893d3 100644 --- a/nixos/lib/test-driver/test-driver.py +++ b/nixos/lib/test-driver/test-driver.py @@ -6,6 +6,7 @@ from xml.sax.saxutils import XMLGenerator import _thread import atexit import base64 +import codecs import os import pathlib import ptpython.repl @@ -115,6 +116,7 @@ def create_vlan(vlan_nr: str) -> Tuple[str, str, "subprocess.Popen[bytes]", Any] fd.write("version\n") # TODO: perl version checks if this can be read from # an if not, dies. we could hang here forever. Fix it. + assert vde_process.stdout is not None vde_process.stdout.readline() if not os.path.exists(os.path.join(vde_socket, "ctl")): raise Exception("cannot start vde_switch") @@ -139,7 +141,7 @@ def retry(fn: Callable) -> None: class Logger: def __init__(self) -> None: self.logfile = os.environ.get("LOGFILE", "/dev/null") - self.logfile_handle = open(self.logfile, "wb") + self.logfile_handle = codecs.open(self.logfile, "wb") self.xml = XMLGenerator(self.logfile_handle, encoding="utf-8") self.queue: "Queue[Dict[str, str]]" = Queue(1000) @@ -739,6 +741,7 @@ class Machine: self.shell, _ = self.shell_socket.accept() def process_serial_output() -> None: + assert self.process.stdout is not None for _line in self.process.stdout: # Ignore undecodable bytes that may occur in boot menus line = _line.decode(errors="ignore").replace("\r", "").rstrip() |