Skip to content

Commit a82a539

Browse files
committed
wip
1 parent 42d25dd commit a82a539

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

tests/dev-requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ pytest-metadata==3.1.1
44
pytest-html==4.1.1
55
pytest-xdist==3.6.1
66
PyVirtualDisplay==3.0
7-
keyboard==0.13.5
7+
ahk==1.8.0

tests/src/test_rendering.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
from contextlib import contextmanager
1010
from pathlib import Path
1111

12-
import keyboard
1312
import pytest
1413
from pyvirtualdisplay.smartdisplay import SmartDisplay
1514

15+
if sys.platform == "win32":
16+
from ahk import AHK
17+
1618
logger = logging.getLogger(__name__)
1719

1820

@@ -157,12 +159,13 @@ def run_process_capture_logs(command, cwd, name="", process_holder=None) -> None
157159

158160
def run_typing_process(workdir, text: str) -> None:
159161
if sys.platform == "win32":
160-
#with open(workdir / "type.ahk", "w", encoding="utf-8") as f:
161-
# f.write("SetKeyDelay 400, 100\n") # 400ms between keys, 100ms between down/up.
162-
# f.write(f"SendEvent \"{text}\"\n")
163-
# f.write("exit")
164-
#result = subprocess.run(["AutoHotkey.exe", "/ErrorStdOut", "type.ahk"], cwd=workdir)
165-
keyboard.write(text, delay=0.4)
162+
# with open(workdir / "type.ahk", "w", encoding="utf-8") as f:
163+
# f.write("SetKeyDelay 400, 100\n") # 400ms between keys, 100ms between down/up.
164+
# f.write(f"SendEvent \"{text}\"\n")
165+
# f.write("exit")
166+
# result = subprocess.run(["AutoHotkey.exe", "/ErrorStdOut", "type.ahk"], cwd=workdir)
167+
ahk = AHK()
168+
ahk.type(text);
166169
else:
167170
result = subprocess.run(["xdotool", "type", "--delay", "400", text])
168171
logger.info(f"stdout: {result.stdout}")

0 commit comments

Comments
 (0)