pytest-embedded 2.9.2__tar.gz → 2.9.3__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-2.9.2 → pytest_embedded-2.9.3}/PKG-INFO +1 -1
- {pytest_embedded-2.9.2 → pytest_embedded-2.9.3}/pytest_embedded/__init__.py +1 -1
- {pytest_embedded-2.9.2 → pytest_embedded-2.9.3}/pytest_embedded/plugin.py +10 -7
- {pytest_embedded-2.9.2 → pytest_embedded-2.9.3}/tests/test_base.py +11 -4
- {pytest_embedded-2.9.2 → pytest_embedded-2.9.3}/LICENSE +0 -0
- {pytest_embedded-2.9.2 → pytest_embedded-2.9.3}/README.md +0 -0
- {pytest_embedded-2.9.2 → pytest_embedded-2.9.3}/pyproject.toml +0 -0
- {pytest_embedded-2.9.2 → pytest_embedded-2.9.3}/pytest_embedded/app.py +0 -0
- {pytest_embedded-2.9.2 → pytest_embedded-2.9.3}/pytest_embedded/dut.py +0 -0
- {pytest_embedded-2.9.2 → pytest_embedded-2.9.3}/pytest_embedded/dut_factory.py +0 -0
- {pytest_embedded-2.9.2 → pytest_embedded-2.9.3}/pytest_embedded/log.py +0 -0
- {pytest_embedded-2.9.2 → pytest_embedded-2.9.3}/pytest_embedded/unity.py +0 -0
- {pytest_embedded-2.9.2 → pytest_embedded-2.9.3}/pytest_embedded/utils.py +0 -0
|
@@ -1349,16 +1349,19 @@ def dut(
|
|
|
1349
1349
|
@pytest.fixture
|
|
1350
1350
|
def unity_tester(dut: t.Union['IdfDut', tuple['IdfDut']]) -> t.Optional['CaseTester']:
|
|
1351
1351
|
try:
|
|
1352
|
-
from pytest_embedded_idf import CaseTester
|
|
1352
|
+
from pytest_embedded_idf import CaseTester
|
|
1353
|
+
from pytest_embedded_idf.unity_tester import IdfUnityDutMixin
|
|
1353
1354
|
except ImportError:
|
|
1354
1355
|
yield None
|
|
1355
1356
|
else:
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1357
|
+
duts = to_list(dut)
|
|
1358
|
+
# `CaseTester` drives the unity test menu, which every dut carrying
|
|
1359
|
+
# `IdfUnityDutMixin` provides: `IdfDut` inherits it, and the dut factory
|
|
1360
|
+
# mixes it into the qemu and esp-emu duts when the idf service is used.
|
|
1361
|
+
if all(isinstance(_dut, IdfUnityDutMixin) for _dut in duts):
|
|
1362
|
+
yield CaseTester(duts)
|
|
1363
|
+
else:
|
|
1364
|
+
yield None
|
|
1362
1365
|
|
|
1363
1366
|
|
|
1364
1367
|
##################
|
|
@@ -334,20 +334,27 @@ def test_expect(testdir):
|
|
|
334
334
|
def test_expect_from_timeout(testdir):
|
|
335
335
|
testdir.makepyfile(r"""
|
|
336
336
|
import threading
|
|
337
|
-
import time
|
|
338
337
|
import pexpect
|
|
339
338
|
|
|
340
339
|
def test_expect_from_timeout(msg_queue, dut):
|
|
340
|
+
stop = threading.Event()
|
|
341
|
+
|
|
341
342
|
def write_bytes():
|
|
342
343
|
for _ in range(5):
|
|
344
|
+
if stop.is_set():
|
|
345
|
+
return
|
|
343
346
|
msg_queue.write('1')
|
|
344
|
-
|
|
347
|
+
stop.wait(1.5)
|
|
345
348
|
|
|
346
349
|
write_thread = threading.Thread(target=write_bytes, daemon=True)
|
|
347
350
|
write_thread.start()
|
|
348
351
|
|
|
349
|
-
|
|
350
|
-
|
|
352
|
+
try:
|
|
353
|
+
res = dut.expect(pexpect.TIMEOUT, timeout=4)
|
|
354
|
+
assert res == b'111'
|
|
355
|
+
finally:
|
|
356
|
+
stop.set()
|
|
357
|
+
write_thread.join(timeout=2)
|
|
351
358
|
""")
|
|
352
359
|
|
|
353
360
|
result = testdir.runpytest('-s')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|