Skip to content

Commit deedebd

Browse files
authored
👷 Add windows-latest to test matrix (#158)
* Use different codes for special keys on Windows * Add windows to test matrix
1 parent c0746bb commit deedebd

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

‎.github/workflows/test.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
test:
2626
strategy:
2727
matrix:
28-
os: [ ubuntu-latest, macos-latest ]
28+
os: [ ubuntu-latest, macos-latest, windows-latest ]
2929
python-version: ["3.14"]
3030
uv-resolution:
3131
- highest
@@ -37,7 +37,7 @@ jobs:
3737
os: macos-latest
3838
uv-resolution: lowest-direct
3939
- python-version: "3.12"
40-
os: ubuntu-latest
40+
os: windows-latest
4141
uv-resolution: highest
4242
- python-version: "3.13"
4343
os: macos-latest

‎tests/utils.py‎

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import base64
22
import json
33
import os
4+
import sys
45
from collections.abc import Generator
56
from contextlib import contextmanager
67
from pathlib import Path
7-
from typing import Any, Union
8+
from typing import Any
89

910

1011
@contextmanager
11-
def changing_dir(directory: Union[str, Path]) -> Generator[None, None, None]:
12+
def changing_dir(directory: str | Path) -> Generator[None, None, None]:
1213
initial_dir = os.getcwd()
1314
os.chdir(directory)
1415
try:
@@ -22,13 +23,25 @@ def build_logs_response(*logs: dict[str, Any]) -> str:
2223
return "\n".join(json.dumps(log) for log in logs)
2324

2425

25-
class Keys:
26-
RIGHT_ARROW = "\x1b[C"
27-
DOWN_ARROW = "\x1b[B"
28-
ENTER = "\r"
29-
CTRL_C = "\x03"
30-
TAB = "\t"
31-
BACKSPACE = "\x7f"
26+
if sys.platform == "win32":
27+
28+
class Keys:
29+
RIGHT_ARROW = "\xe0M"
30+
DOWN_ARROW = "\xe0P"
31+
ENTER = "\r"
32+
CTRL_C = "\x03"
33+
TAB = "\t"
34+
BACKSPACE = "\x08"
35+
36+
else:
37+
38+
class Keys:
39+
RIGHT_ARROW = "\x1b[C"
40+
DOWN_ARROW = "\x1b[B"
41+
ENTER = "\r"
42+
CTRL_C = "\x03"
43+
TAB = "\t"
44+
BACKSPACE = "\x7f"
3245

3346

3447
def create_jwt_token(payload: dict[str, Any]) -> str:

0 commit comments

Comments
 (0)