2
2
import logging
3
3
import os
4
4
import typing as t
5
+ from pathlib import Path
5
6
6
7
from packaging .version import Version
7
8
from pytest_embedded .log import DuplicateStdoutPopen , MessageQueue
@@ -47,7 +48,6 @@ def __init__(
47
48
** kwargs ,
48
49
):
49
50
self .app = app
50
- self .firmware_resolver = firmware_resolver
51
51
52
52
# Get Wokwi API token
53
53
token = os .getenv ('WOKWI_CLI_TOKEN' )
@@ -76,8 +76,11 @@ def __init__(
76
76
77
77
# Connect and start simulation
78
78
try :
79
- firmware_path = self .firmware_resolver .resolve_firmware (app )
80
- self ._setup_simulation (wokwi_diagram , firmware_path , app .elf_file )
79
+ flasher_args = firmware_resolver .resolve_firmware (app )
80
+ firmware_path = Path (flasher_args ).as_posix ()
81
+ elf_path = Path (app .elf_file ).as_posix ()
82
+
83
+ self ._setup_simulation (wokwi_diagram , firmware_path , elf_path )
81
84
self ._start_serial_monitoring ()
82
85
except Exception as e :
83
86
self .close ()
@@ -90,13 +93,14 @@ def _setup_simulation(self, diagram: str, firmware_path: str, elf_path: str):
90
93
91
94
# Upload files
92
95
self .client .upload_file ('diagram.json' , diagram )
93
- self .client .upload_file ('pytest.bin' , firmware_path )
96
+ firmware = self .client .upload_file ('pytest.bin' , firmware_path )
97
+
94
98
self .client .upload_file ('pytest.elf' , elf_path )
95
99
96
100
logging .info ('Uploaded diagram and firmware to Wokwi. Starting simulation...' )
97
101
98
102
# Start simulation
99
- self .client .start_simulation (firmware = 'pytest.bin' , elf = 'pytest.elf' )
103
+ self .client .start_simulation (firmware , elf = 'pytest.elf' )
100
104
101
105
def _start_serial_monitoring (self ):
102
106
"""Start monitoring serial output and forward to stdout and message queue."""
0 commit comments