From 7c7389b5f00bdcac9425eec5f709cb17e3ed7370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sawicz?= Date: Fri, 16 Aug 2024 13:41:04 +0200 Subject: [PATCH] tests: drop unused file --- .../tests/display_server_static_file.py | 47 ------------------- 1 file changed, 47 deletions(-) delete mode 100644 mir-ci/mir_ci/tests/display_server_static_file.py diff --git a/mir-ci/mir_ci/tests/display_server_static_file.py b/mir-ci/mir_ci/tests/display_server_static_file.py deleted file mode 100644 index 82bb670e..00000000 --- a/mir-ci/mir_ci/tests/display_server_static_file.py +++ /dev/null @@ -1,47 +0,0 @@ -import importlib -import os -import tempfile -from typing import Any - -from mir_ci.program.display_server import DisplayServer - - -class DisplayServerStaticFile: - def __init__(self, local_server, *args, **kwargs): - self.local_server = local_server - tmp_file = tempfile.NamedTemporaryFile(delete=False) - self.tmp_filename = tmp_file.name - try: - os.remove(self.tmp_filename) - except OSError: - pass - - config_file = f"static={self.tmp_filename}" - - if "env" not in kwargs: - kwargs["env"] = {} - - if "MIR_SERVER_DISPLAY_CONFIG" not in kwargs["env"]: - kwargs["env"]["MIR_SERVER_DISPLAY_CONFIG"] = config_file - - self.server = DisplayServer(self.local_server, *args, **kwargs) - - async def __aenter__(self) -> "DisplayServerStaticFile": - await self.server.__aenter__() - return self - - async def __aexit__(self, *args): - await self.server.__aexit__(*args) - - def read_config(self) -> Any: - yaml = importlib.import_module("yaml") - with open(self.tmp_filename, "r") as file: - # the yaml parser doesn't like tabs before our comments - content = file.read().replace("\t#", " #") - data = yaml.safe_load(content) - return data - - def write_config(self, content: Any) -> None: - yaml = importlib.import_module("yaml") - with open(self.tmp_filename, "w") as file: - yaml.dump(content, file)