pytest-embedded 1.17.0a2__tar.gz → 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pytest_embedded-1.17.0a2 → pytest_embedded-2.0.0}/PKG-INFO +2 -5
- {pytest_embedded-1.17.0a2 → pytest_embedded-2.0.0}/pyproject.toml +1 -4
- {pytest_embedded-1.17.0a2 → pytest_embedded-2.0.0}/pytest_embedded/__init__.py +1 -1
- {pytest_embedded-1.17.0a2 → pytest_embedded-2.0.0}/pytest_embedded/app.py +3 -4
- {pytest_embedded-1.17.0a2 → pytest_embedded-2.0.0}/pytest_embedded/dut.py +11 -10
- {pytest_embedded-1.17.0a2 → pytest_embedded-2.0.0}/pytest_embedded/dut_factory.py +140 -129
- {pytest_embedded-1.17.0a2 → pytest_embedded-2.0.0}/pytest_embedded/log.py +45 -27
- {pytest_embedded-1.17.0a2 → pytest_embedded-2.0.0}/pytest_embedded/plugin.py +73 -111
- {pytest_embedded-1.17.0a2 → pytest_embedded-2.0.0}/pytest_embedded/unity.py +9 -9
- {pytest_embedded-1.17.0a2 → pytest_embedded-2.0.0}/pytest_embedded/utils.py +10 -10
- {pytest_embedded-1.17.0a2 → pytest_embedded-2.0.0}/tests/test_base.py +16 -46
- {pytest_embedded-1.17.0a2 → pytest_embedded-2.0.0}/LICENSE +0 -0
- {pytest_embedded-1.17.0a2 → pytest_embedded-2.0.0}/README.md +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-embedded
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: A pytest plugin that designed for embedded testing.
|
|
5
5
|
Author-email: Fu Hanxi <fuhanxi@espressif.com>
|
|
6
|
-
Requires-Python: >=3.
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
Classifier: Development Status :: 5 - Production/Stable
|
|
9
9
|
Classifier: Framework :: Pytest
|
|
@@ -12,9 +12,6 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
|
13
13
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
18
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -15,9 +15,6 @@ classifiers = [
|
|
|
15
15
|
"Operating System :: OS Independent",
|
|
16
16
|
"Programming Language :: Python :: 3 :: Only",
|
|
17
17
|
"Programming Language :: Python :: 3",
|
|
18
|
-
"Programming Language :: Python :: 3.7",
|
|
19
|
-
"Programming Language :: Python :: 3.8",
|
|
20
|
-
"Programming Language :: Python :: 3.9",
|
|
21
18
|
"Programming Language :: Python :: 3.10",
|
|
22
19
|
"Programming Language :: Python :: 3.11",
|
|
23
20
|
"Programming Language :: Python :: 3.12",
|
|
@@ -26,7 +23,7 @@ classifiers = [
|
|
|
26
23
|
"Topic :: Software Development :: Testing",
|
|
27
24
|
]
|
|
28
25
|
dynamic = ["version", "description"]
|
|
29
|
-
requires-python = ">=3.
|
|
26
|
+
requires-python = ">=3.10"
|
|
30
27
|
|
|
31
28
|
dependencies = [
|
|
32
29
|
"pytest>=7.0",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import os
|
|
3
|
-
from typing import Optional
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
class App:
|
|
@@ -14,8 +13,8 @@ class App:
|
|
|
14
13
|
|
|
15
14
|
def __init__(
|
|
16
15
|
self,
|
|
17
|
-
app_path:
|
|
18
|
-
build_dir:
|
|
16
|
+
app_path: str | None = None,
|
|
17
|
+
build_dir: str | None = None,
|
|
19
18
|
**kwargs,
|
|
20
19
|
):
|
|
21
20
|
if app_path is None:
|
|
@@ -27,7 +26,7 @@ class App:
|
|
|
27
26
|
for k, v in kwargs.items():
|
|
28
27
|
setattr(self, k, v)
|
|
29
28
|
|
|
30
|
-
def _get_binary_path(self, build_dir:
|
|
29
|
+
def _get_binary_path(self, build_dir: str | None = None) -> str | None:
|
|
31
30
|
if not build_dir:
|
|
32
31
|
return None
|
|
33
32
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import functools
|
|
2
2
|
import logging
|
|
3
|
-
import multiprocessing
|
|
4
3
|
import os.path
|
|
5
4
|
import re
|
|
6
|
-
from
|
|
5
|
+
from collections.abc import Callable
|
|
6
|
+
from re import Match
|
|
7
|
+
from typing import AnyStr
|
|
7
8
|
|
|
8
9
|
import pexpect
|
|
9
10
|
|
|
10
11
|
from .app import App
|
|
11
|
-
from .log import PexpectProcess
|
|
12
|
+
from .log import MessageQueue, PexpectProcess
|
|
12
13
|
from .unity import UNITY_SUMMARY_LINE_REGEX, TestSuite
|
|
13
14
|
from .utils import Meta, _InjectMixinCls, remove_asci_color_code, to_bytes, to_list
|
|
14
15
|
|
|
@@ -27,11 +28,11 @@ class Dut(_InjectMixinCls):
|
|
|
27
28
|
def __init__(
|
|
28
29
|
self,
|
|
29
30
|
pexpect_proc: PexpectProcess,
|
|
30
|
-
msg_queue:
|
|
31
|
+
msg_queue: MessageQueue,
|
|
31
32
|
app: App,
|
|
32
33
|
pexpect_logfile: str,
|
|
33
34
|
test_case_name: str,
|
|
34
|
-
meta:
|
|
35
|
+
meta: Meta | None = None,
|
|
35
36
|
**kwargs,
|
|
36
37
|
) -> None:
|
|
37
38
|
self._q = msg_queue
|
|
@@ -64,17 +65,17 @@ class Dut(_InjectMixinCls):
|
|
|
64
65
|
"""
|
|
65
66
|
self._q.put(to_bytes(s))
|
|
66
67
|
|
|
67
|
-
def _pexpect_func(func) -> Callable[...,
|
|
68
|
+
def _pexpect_func(func) -> Callable[..., Match | AnyStr]:
|
|
68
69
|
@functools.wraps(func)
|
|
69
70
|
def wrapper(
|
|
70
71
|
self,
|
|
71
72
|
pattern,
|
|
72
73
|
*args,
|
|
73
74
|
expect_all: bool = False,
|
|
74
|
-
not_matching:
|
|
75
|
+
not_matching: list[str | re.Pattern] = (),
|
|
75
76
|
return_what_before_match: bool = False,
|
|
76
77
|
**kwargs,
|
|
77
|
-
) ->
|
|
78
|
+
) -> Match | AnyStr | list[Match | AnyStr]:
|
|
78
79
|
if return_what_before_match and expect_all:
|
|
79
80
|
raise ValueError('`return_what_before_match` and `expect_all` cannot be `True` at the same time.')
|
|
80
81
|
|
|
@@ -172,7 +173,7 @@ class Dut(_InjectMixinCls):
|
|
|
172
173
|
self,
|
|
173
174
|
remove_asci_escape_code: bool = True,
|
|
174
175
|
timeout: float = 60,
|
|
175
|
-
extra_before:
|
|
176
|
+
extra_before: AnyStr | None = None,
|
|
176
177
|
) -> None:
|
|
177
178
|
"""
|
|
178
179
|
Expect a unity test summary block and parse the output into junit report.
|
|
@@ -213,7 +214,7 @@ class Dut(_InjectMixinCls):
|
|
|
213
214
|
@_InjectMixinCls.require_services('idf')
|
|
214
215
|
def run_all_single_board_cases(
|
|
215
216
|
self,
|
|
216
|
-
group:
|
|
217
|
+
group: str | None = None,
|
|
217
218
|
reset: bool = False,
|
|
218
219
|
timeout: float = 30,
|
|
219
220
|
run_ignore_cases: bool = False,
|
|
@@ -17,21 +17,18 @@ if t.TYPE_CHECKING:
|
|
|
17
17
|
from pytest_embedded_jtag import Gdb, OpenOcd
|
|
18
18
|
from pytest_embedded_qemu import Qemu
|
|
19
19
|
from pytest_embedded_serial import Serial
|
|
20
|
-
from pytest_embedded_wokwi import
|
|
20
|
+
from pytest_embedded_wokwi import Wokwi
|
|
21
21
|
|
|
22
22
|
from . import App, Dut
|
|
23
23
|
from .log import MessageQueue, PexpectProcess
|
|
24
24
|
from .utils import FIXTURES_SERVICES, ClassCliOptions, to_str
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
def _drop_none_kwargs(kwargs:
|
|
27
|
+
def _drop_none_kwargs(kwargs: dict[t.Any, t.Any]):
|
|
28
28
|
return {k: v for k, v in kwargs.items() if v is not None}
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
_ctx = multiprocessing.get_context('fork')
|
|
33
|
-
else:
|
|
34
|
-
_ctx = multiprocessing.get_context()
|
|
31
|
+
_ctx = multiprocessing.get_context('spawn')
|
|
35
32
|
|
|
36
33
|
_stdout = sys.__stdout__
|
|
37
34
|
|
|
@@ -45,10 +42,6 @@ DUT_GLOBAL_INDEX = 0
|
|
|
45
42
|
PARAMETRIZED_FIXTURES_CACHE = {}
|
|
46
43
|
|
|
47
44
|
|
|
48
|
-
def msg_queue_gn() -> MessageQueue:
|
|
49
|
-
return MessageQueue()
|
|
50
|
-
|
|
51
|
-
|
|
52
45
|
def _listen(q: MessageQueue, filepath: str, with_timestamp: bool = True, count: int = 1, total: int = 1) -> None:
|
|
53
46
|
shall_add_prefix = True
|
|
54
47
|
while True:
|
|
@@ -145,9 +138,6 @@ def _fixture_classes_and_options_fn(
|
|
|
145
138
|
qemu_prog_path,
|
|
146
139
|
qemu_cli_args,
|
|
147
140
|
qemu_extra_args,
|
|
148
|
-
wokwi_cli_path,
|
|
149
|
-
wokwi_timeout,
|
|
150
|
-
wokwi_scenario,
|
|
151
141
|
wokwi_diagram,
|
|
152
142
|
skip_regenerate_image,
|
|
153
143
|
encrypt,
|
|
@@ -161,9 +151,9 @@ def _fixture_classes_and_options_fn(
|
|
|
161
151
|
_meta,
|
|
162
152
|
**kwargs,
|
|
163
153
|
) -> ClassCliOptions:
|
|
164
|
-
classes:
|
|
165
|
-
mixins:
|
|
166
|
-
kwargs:
|
|
154
|
+
classes: dict[str, type] = {}
|
|
155
|
+
mixins: dict[str, list[type]] = defaultdict(list)
|
|
156
|
+
kwargs: dict[str, dict[str, t.Any]] = defaultdict(dict)
|
|
167
157
|
|
|
168
158
|
for fixture in FIXTURES_SERVICES.keys():
|
|
169
159
|
if fixture == 'app':
|
|
@@ -173,22 +163,26 @@ def _fixture_classes_and_options_fn(
|
|
|
173
163
|
from pytest_embedded_qemu import DEFAULT_IMAGE_FN, QemuApp
|
|
174
164
|
|
|
175
165
|
classes[fixture] = QemuApp
|
|
176
|
-
kwargs[fixture].update(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
166
|
+
kwargs[fixture].update(
|
|
167
|
+
{
|
|
168
|
+
'msg_queue': msg_queue,
|
|
169
|
+
'part_tool': part_tool,
|
|
170
|
+
'qemu_image_path': qemu_image_path,
|
|
171
|
+
'skip_regenerate_image': skip_regenerate_image,
|
|
172
|
+
'encrypt': encrypt,
|
|
173
|
+
'keyfile': keyfile,
|
|
174
|
+
'qemu_prog_path': qemu_prog_path,
|
|
175
|
+
}
|
|
176
|
+
)
|
|
185
177
|
else:
|
|
186
178
|
from pytest_embedded_idf import IdfApp
|
|
187
179
|
|
|
188
180
|
classes[fixture] = IdfApp
|
|
189
|
-
kwargs[fixture].update(
|
|
190
|
-
|
|
191
|
-
|
|
181
|
+
kwargs[fixture].update(
|
|
182
|
+
{
|
|
183
|
+
'part_tool': part_tool,
|
|
184
|
+
}
|
|
185
|
+
)
|
|
192
186
|
elif 'arduino' in _services:
|
|
193
187
|
from pytest_embedded_arduino import ArduinoApp
|
|
194
188
|
|
|
@@ -226,26 +220,32 @@ def _fixture_classes_and_options_fn(
|
|
|
226
220
|
from pytest_embedded_idf import IdfSerial
|
|
227
221
|
|
|
228
222
|
classes[fixture] = IdfSerial
|
|
229
|
-
kwargs[fixture].update(
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
223
|
+
kwargs[fixture].update(
|
|
224
|
+
{
|
|
225
|
+
'app': None,
|
|
226
|
+
'confirm_target_elf_sha256': confirm_target_elf_sha256,
|
|
227
|
+
'erase_nvs': erase_nvs,
|
|
228
|
+
}
|
|
229
|
+
)
|
|
234
230
|
elif 'arduino' in _services:
|
|
235
231
|
from pytest_embedded_arduino import ArduinoSerial
|
|
236
232
|
|
|
237
233
|
classes[fixture] = ArduinoSerial
|
|
238
|
-
kwargs[fixture].update(
|
|
239
|
-
|
|
240
|
-
|
|
234
|
+
kwargs[fixture].update(
|
|
235
|
+
{
|
|
236
|
+
'app': None,
|
|
237
|
+
}
|
|
238
|
+
)
|
|
241
239
|
elif 'nuttx' in _services:
|
|
242
240
|
from pytest_embedded_nuttx import NuttxSerial
|
|
243
241
|
|
|
244
242
|
classes[fixture] = NuttxSerial
|
|
245
|
-
kwargs[fixture].update(
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
243
|
+
kwargs[fixture].update(
|
|
244
|
+
{
|
|
245
|
+
'app': None,
|
|
246
|
+
'baud': int(baud or NuttxSerial.SERIAL_BAUDRATE),
|
|
247
|
+
}
|
|
248
|
+
)
|
|
249
249
|
else:
|
|
250
250
|
from pytest_embedded_serial_esp import EspSerial
|
|
251
251
|
|
|
@@ -309,19 +309,18 @@ def _fixture_classes_and_options_fn(
|
|
|
309
309
|
}
|
|
310
310
|
elif fixture == 'wokwi':
|
|
311
311
|
if 'wokwi' in _services:
|
|
312
|
-
from pytest_embedded_wokwi import
|
|
313
|
-
|
|
314
|
-
classes[fixture] =
|
|
315
|
-
kwargs[fixture].update(
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
})
|
|
312
|
+
from pytest_embedded_wokwi import Wokwi
|
|
313
|
+
|
|
314
|
+
classes[fixture] = Wokwi
|
|
315
|
+
kwargs[fixture].update(
|
|
316
|
+
{
|
|
317
|
+
'wokwi_diagram': wokwi_diagram,
|
|
318
|
+
'msg_queue': msg_queue,
|
|
319
|
+
'app': None,
|
|
320
|
+
'meta': _meta,
|
|
321
|
+
'firmware_resolver': None,
|
|
322
|
+
}
|
|
323
|
+
)
|
|
325
324
|
elif fixture == 'dut':
|
|
326
325
|
classes[fixture] = Dut
|
|
327
326
|
kwargs[fixture] = {
|
|
@@ -342,9 +341,11 @@ def _fixture_classes_and_options_fn(
|
|
|
342
341
|
from pytest_embedded_wokwi import WokwiDut
|
|
343
342
|
|
|
344
343
|
classes[fixture] = WokwiDut
|
|
345
|
-
kwargs[fixture].update(
|
|
346
|
-
|
|
347
|
-
|
|
344
|
+
kwargs[fixture].update(
|
|
345
|
+
{
|
|
346
|
+
'wokwi': None,
|
|
347
|
+
}
|
|
348
|
+
)
|
|
348
349
|
|
|
349
350
|
if 'idf' in _services:
|
|
350
351
|
from pytest_embedded_wokwi.idf import IDFFirmwareResolver
|
|
@@ -361,16 +362,20 @@ def _fixture_classes_and_options_fn(
|
|
|
361
362
|
from pytest_embedded_nuttx import NuttxQemuDut
|
|
362
363
|
|
|
363
364
|
classes[fixture] = NuttxQemuDut
|
|
364
|
-
kwargs[fixture].update(
|
|
365
|
-
|
|
366
|
-
|
|
365
|
+
kwargs[fixture].update(
|
|
366
|
+
{
|
|
367
|
+
'qemu': None,
|
|
368
|
+
}
|
|
369
|
+
)
|
|
367
370
|
else:
|
|
368
371
|
from pytest_embedded_qemu import QemuDut
|
|
369
372
|
|
|
370
373
|
classes[fixture] = QemuDut
|
|
371
|
-
kwargs[fixture].update(
|
|
372
|
-
|
|
373
|
-
|
|
374
|
+
kwargs[fixture].update(
|
|
375
|
+
{
|
|
376
|
+
'qemu': None,
|
|
377
|
+
}
|
|
378
|
+
)
|
|
374
379
|
elif 'jtag' in _services:
|
|
375
380
|
if 'idf' in _services:
|
|
376
381
|
from pytest_embedded_idf import IdfDut
|
|
@@ -381,42 +386,52 @@ def _fixture_classes_and_options_fn(
|
|
|
381
386
|
|
|
382
387
|
classes[fixture] = SerialDut
|
|
383
388
|
|
|
384
|
-
kwargs[fixture].update(
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
+
kwargs[fixture].update(
|
|
390
|
+
{
|
|
391
|
+
'serial': None,
|
|
392
|
+
'openocd': None,
|
|
393
|
+
'gdb': None,
|
|
394
|
+
}
|
|
395
|
+
)
|
|
389
396
|
elif 'serial' in _services or 'esp' in _services:
|
|
390
397
|
if 'esp' in _services and 'idf' in _services:
|
|
391
398
|
from pytest_embedded_idf import IdfDut
|
|
392
399
|
|
|
393
400
|
classes[fixture] = IdfDut
|
|
394
|
-
kwargs[fixture].update(
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
401
|
+
kwargs[fixture].update(
|
|
402
|
+
{
|
|
403
|
+
'skip_check_coredump': skip_check_coredump,
|
|
404
|
+
'panic_output_decode_script': panic_output_decode_script,
|
|
405
|
+
}
|
|
406
|
+
)
|
|
398
407
|
elif 'esp' in _services and 'nuttx' in _services:
|
|
399
408
|
from pytest_embedded_nuttx import NuttxEspDut
|
|
400
409
|
|
|
401
410
|
classes[fixture] = NuttxEspDut
|
|
402
|
-
kwargs[fixture].update(
|
|
403
|
-
|
|
404
|
-
|
|
411
|
+
kwargs[fixture].update(
|
|
412
|
+
{
|
|
413
|
+
'serial': None,
|
|
414
|
+
}
|
|
415
|
+
)
|
|
405
416
|
elif 'nuttx' in _services:
|
|
406
417
|
from pytest_embedded_nuttx import NuttxSerialDut
|
|
407
418
|
|
|
408
419
|
classes[fixture] = NuttxSerialDut
|
|
409
|
-
kwargs[fixture].update(
|
|
410
|
-
|
|
411
|
-
|
|
420
|
+
kwargs[fixture].update(
|
|
421
|
+
{
|
|
422
|
+
'serial': None,
|
|
423
|
+
}
|
|
424
|
+
)
|
|
412
425
|
else:
|
|
413
426
|
from pytest_embedded_serial import SerialDut
|
|
414
427
|
|
|
415
428
|
classes[fixture] = SerialDut
|
|
416
429
|
|
|
417
|
-
kwargs[fixture].update(
|
|
418
|
-
|
|
419
|
-
|
|
430
|
+
kwargs[fixture].update(
|
|
431
|
+
{
|
|
432
|
+
'serial': None,
|
|
433
|
+
}
|
|
434
|
+
)
|
|
420
435
|
|
|
421
436
|
return ClassCliOptions(classes, mixins, kwargs)
|
|
422
437
|
|
|
@@ -427,7 +442,7 @@ def app_fn(_fixture_classes_and_options: ClassCliOptions) -> App:
|
|
|
427
442
|
return cls(**_drop_none_kwargs(kwargs))
|
|
428
443
|
|
|
429
444
|
|
|
430
|
-
def serial_gn(_fixture_classes_and_options, msg_queue, app) -> t.
|
|
445
|
+
def serial_gn(_fixture_classes_and_options, msg_queue, app) -> t.Union['Serial', 'LinuxSerial'] | None:
|
|
431
446
|
if hasattr(app, 'target') and app.target == 'linux':
|
|
432
447
|
from pytest_embedded_idf import LinuxSerial
|
|
433
448
|
|
|
@@ -495,7 +510,7 @@ def qemu_gn(_fixture_classes_and_options: ClassCliOptions, app) -> t.Optional['Q
|
|
|
495
510
|
return cls(**_drop_none_kwargs(kwargs))
|
|
496
511
|
|
|
497
512
|
|
|
498
|
-
def wokwi_gn(_fixture_classes_and_options: ClassCliOptions, app) -> t.Optional['
|
|
513
|
+
def wokwi_gn(_fixture_classes_and_options: ClassCliOptions, app) -> t.Optional['Wokwi']:
|
|
499
514
|
"""A wokwi subprocess that could read/redirect/write"""
|
|
500
515
|
if 'wokwi' not in _fixture_classes_and_options.classes:
|
|
501
516
|
return None
|
|
@@ -513,10 +528,10 @@ def dut_gn(
|
|
|
513
528
|
openocd: t.Optional['OpenOcd'],
|
|
514
529
|
gdb: t.Optional['Gdb'],
|
|
515
530
|
app: App,
|
|
516
|
-
serial: t.
|
|
531
|
+
serial: t.Union['Serial', 'LinuxSerial'] | None,
|
|
517
532
|
qemu: t.Optional['Qemu'],
|
|
518
|
-
wokwi: t.Optional['
|
|
519
|
-
) ->
|
|
533
|
+
wokwi: t.Optional['Wokwi'],
|
|
534
|
+
) -> Dut | list[Dut]:
|
|
520
535
|
global DUT_GLOBAL_INDEX
|
|
521
536
|
DUT_GLOBAL_INDEX += 1
|
|
522
537
|
|
|
@@ -550,7 +565,7 @@ def dut_gn(
|
|
|
550
565
|
return cls(**_drop_none_kwargs(kwargs), mixins=mixins)
|
|
551
566
|
|
|
552
567
|
|
|
553
|
-
def set_parametrized_fixtures_cache(values:
|
|
568
|
+
def set_parametrized_fixtures_cache(values: dict):
|
|
554
569
|
global PARAMETRIZED_FIXTURES_CACHE
|
|
555
570
|
PARAMETRIZED_FIXTURES_CACHE = values.copy()
|
|
556
571
|
|
|
@@ -561,7 +576,7 @@ def _close_or_terminate(obj):
|
|
|
561
576
|
return
|
|
562
577
|
|
|
563
578
|
try:
|
|
564
|
-
if isinstance(obj,
|
|
579
|
+
if isinstance(obj, subprocess.Popen | multiprocessing.process.BaseProcess):
|
|
565
580
|
obj.terminate()
|
|
566
581
|
obj.kill()
|
|
567
582
|
elif isinstance(obj, io.IOBase):
|
|
@@ -604,7 +619,7 @@ class DutFactory:
|
|
|
604
619
|
# [openocd, gdb, serial, qemu, wokwi, dut] # dut-1
|
|
605
620
|
# ...
|
|
606
621
|
# ]
|
|
607
|
-
obj_stack: t.ClassVar[
|
|
622
|
+
obj_stack: t.ClassVar[list[list[t.Any]]] = []
|
|
608
623
|
|
|
609
624
|
@classmethod
|
|
610
625
|
def close(cls):
|
|
@@ -633,39 +648,36 @@ class DutFactory:
|
|
|
633
648
|
embedded_services: str = '',
|
|
634
649
|
app_path: str = '',
|
|
635
650
|
build_dir: str = 'build',
|
|
636
|
-
port:
|
|
637
|
-
port_serial_number:
|
|
638
|
-
port_location:
|
|
639
|
-
port_mac:
|
|
640
|
-
target:
|
|
641
|
-
beta_target:
|
|
642
|
-
baud:
|
|
643
|
-
flash_port:
|
|
644
|
-
skip_autoflash:
|
|
645
|
-
erase_all:
|
|
646
|
-
esptool_baud:
|
|
647
|
-
esp_flash_force:
|
|
648
|
-
part_tool:
|
|
649
|
-
confirm_target_elf_sha256:
|
|
650
|
-
erase_nvs:
|
|
651
|
-
skip_check_coredump:
|
|
652
|
-
panic_output_decode_script:
|
|
653
|
-
openocd_prog_path:
|
|
654
|
-
openocd_cli_args:
|
|
655
|
-
gdb_prog_path:
|
|
656
|
-
gdb_cli_args:
|
|
657
|
-
no_gdb:
|
|
658
|
-
qemu_image_path:
|
|
659
|
-
qemu_prog_path:
|
|
660
|
-
qemu_cli_args:
|
|
661
|
-
qemu_extra_args:
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
skip_regenerate_image: t.Optional[bool] = None,
|
|
667
|
-
encrypt: t.Optional[bool] = None,
|
|
668
|
-
keyfile: t.Optional[str] = None,
|
|
651
|
+
port: str | None = None,
|
|
652
|
+
port_serial_number: str | None = None,
|
|
653
|
+
port_location: str | None = None,
|
|
654
|
+
port_mac: str | None = None,
|
|
655
|
+
target: str | None = None,
|
|
656
|
+
beta_target: str | None = None,
|
|
657
|
+
baud: int | None = None,
|
|
658
|
+
flash_port: str | None = None,
|
|
659
|
+
skip_autoflash: bool | None = None,
|
|
660
|
+
erase_all: bool | None = None,
|
|
661
|
+
esptool_baud: int | None = None,
|
|
662
|
+
esp_flash_force: bool | None = False,
|
|
663
|
+
part_tool: str | None = None,
|
|
664
|
+
confirm_target_elf_sha256: bool | None = None,
|
|
665
|
+
erase_nvs: bool | None = None,
|
|
666
|
+
skip_check_coredump: bool | None = None,
|
|
667
|
+
panic_output_decode_script: str | None = None,
|
|
668
|
+
openocd_prog_path: str | None = None,
|
|
669
|
+
openocd_cli_args: str | None = None,
|
|
670
|
+
gdb_prog_path: str | None = None,
|
|
671
|
+
gdb_cli_args: str | None = None,
|
|
672
|
+
no_gdb: bool | None = None,
|
|
673
|
+
qemu_image_path: str | None = None,
|
|
674
|
+
qemu_prog_path: str | None = None,
|
|
675
|
+
qemu_cli_args: str | None = None,
|
|
676
|
+
qemu_extra_args: str | None = None,
|
|
677
|
+
wokwi_diagram: str | None = None,
|
|
678
|
+
skip_regenerate_image: bool | None = None,
|
|
679
|
+
encrypt: bool | None = None,
|
|
680
|
+
keyfile: str | None = None,
|
|
669
681
|
):
|
|
670
682
|
"""
|
|
671
683
|
Create a Device Under Test (DUT) object with customizable parameters.
|
|
@@ -708,9 +720,6 @@ class DutFactory:
|
|
|
708
720
|
qemu_prog_path: QEMU program path.
|
|
709
721
|
qemu_cli_args: QEMU CLI arguments.
|
|
710
722
|
qemu_extra_args: Additional QEMU arguments.
|
|
711
|
-
wokwi_cli_path: Wokwi CLI path.
|
|
712
|
-
wokwi_timeout: Wokwi timeout.
|
|
713
|
-
wokwi_scenario: Wokwi scenario path.
|
|
714
723
|
wokwi_diagram: Wokwi diagram path.
|
|
715
724
|
skip_regenerate_image: Skip image regeneration flag.
|
|
716
725
|
encrypt: Encryption flag.
|
|
@@ -725,10 +734,15 @@ class DutFactory:
|
|
|
725
734
|
"""
|
|
726
735
|
layout = []
|
|
727
736
|
try:
|
|
728
|
-
|
|
729
|
-
|
|
737
|
+
from .plugin import _MP_MANAGER # avoid circular import
|
|
738
|
+
|
|
739
|
+
if _MP_MANAGER is None:
|
|
740
|
+
raise SystemExit('The _MP_MANAGER is not initialized, please use this function under pytest.')
|
|
741
|
+
|
|
742
|
+
msg_queue = _MP_MANAGER.MessageQueue()
|
|
730
743
|
layout.append(msg_queue)
|
|
731
744
|
|
|
745
|
+
global PARAMETRIZED_FIXTURES_CACHE
|
|
732
746
|
_pexpect_logfile = os.path.join(
|
|
733
747
|
PARAMETRIZED_FIXTURES_CACHE['_meta'].logdir, f'custom-dut-{DUT_GLOBAL_INDEX}.txt'
|
|
734
748
|
)
|
|
@@ -773,9 +787,6 @@ class DutFactory:
|
|
|
773
787
|
'qemu_prog_path': qemu_prog_path,
|
|
774
788
|
'qemu_cli_args': qemu_cli_args,
|
|
775
789
|
'qemu_extra_args': qemu_extra_args,
|
|
776
|
-
'wokwi_cli_path': wokwi_cli_path,
|
|
777
|
-
'wokwi_timeout': wokwi_timeout,
|
|
778
|
-
'wokwi_scenario': wokwi_scenario,
|
|
779
790
|
'wokwi_diagram': wokwi_diagram,
|
|
780
791
|
'skip_regenerate_image': skip_regenerate_image,
|
|
781
792
|
'encrypt': encrypt,
|