From 4382cea3597035437339d9ef01b05736e9025dc7 Mon Sep 17 00:00:00 2001 From: adamws Date: Mon, 25 Nov 2024 18:10:57 +0100 Subject: [PATCH] wip --- tests/dev-requirements.txt | 2 +- tests/src/test_rendering.py | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/dev-requirements.txt b/tests/dev-requirements.txt index faedd52..7e6a1a1 100644 --- a/tests/dev-requirements.txt +++ b/tests/dev-requirements.txt @@ -4,4 +4,4 @@ pytest-metadata==3.1.1 pytest-html==4.1.1 pytest-xdist==3.6.1 PyVirtualDisplay==3.0 -keyboard==0.13.5 +ahk==1.8.0 diff --git a/tests/src/test_rendering.py b/tests/src/test_rendering.py index f5d6d87..535e9e0 100644 --- a/tests/src/test_rendering.py +++ b/tests/src/test_rendering.py @@ -9,10 +9,12 @@ from contextlib import contextmanager from pathlib import Path -import keyboard import pytest from pyvirtualdisplay.smartdisplay import SmartDisplay +if sys.platform == "win32": + from ahk import AHK + logger = logging.getLogger(__name__) @@ -157,17 +159,18 @@ def run_process_capture_logs(command, cwd, name="", process_holder=None) -> None def run_typing_process(workdir, text: str) -> None: if sys.platform == "win32": - #with open(workdir / "type.ahk", "w", encoding="utf-8") as f: - # f.write("SetKeyDelay 400, 100\n") # 400ms between keys, 100ms between down/up. - # f.write(f"SendEvent \"{text}\"\n") - # f.write("exit") - #result = subprocess.run(["AutoHotkey.exe", "/ErrorStdOut", "type.ahk"], cwd=workdir) - keyboard.write(text, delay=0.4) + # with open(workdir / "type.ahk", "w", encoding="utf-8") as f: + # f.write("SetKeyDelay 400, 100\n") # 400ms between keys, 100ms between down/up. + # f.write(f"SendEvent \"{text}\"\n") + # f.write("exit") + # result = subprocess.run(["AutoHotkey.exe", "/ErrorStdOut", "type.ahk"], cwd=workdir) + ahk = AHK() + ahk.type(text); else: result = subprocess.run(["xdotool", "type", "--delay", "400", text]) - logger.info(f"stdout: {result.stdout}") - logger.info(f"stderr: {result.stderr}") - assert result.returncode == 0 + #logger.info(f"stdout: {result.stdout}") + #logger.info(f"stderr: {result.stderr}") + #assert result.returncode == 0 def __get_parameters():