pytest-embedded 1.18.0__tar.gz → 1.18.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-embedded
3
- Version: 1.18.0
3
+ Version: 1.18.2
4
4
  Summary: A pytest plugin that designed for embedded testing.
5
5
  Author-email: Fu Hanxi <fuhanxi@espressif.com>
6
6
  Requires-Python: >=3.7
@@ -6,4 +6,4 @@ from .dut_factory import DutFactory
6
6
 
7
7
  __all__ = ['App', 'Dut', 'DutFactory']
8
8
 
9
- __version__ = '1.18.0'
9
+ __version__ = '1.18.2'
@@ -849,3 +849,16 @@ class DutFactory:
849
849
  _close_or_terminate(obj)
850
850
  del layout
851
851
  raise e
852
+
853
+ @classmethod
854
+ def get_all_duts(cls) -> t.List[Dut]:
855
+ """Get all DUTs created by DutFactory."""
856
+
857
+ duts = []
858
+ for layout in cls.obj_stack:
859
+ # The DUT is always the last object in the layout
860
+ dut = layout[-1]
861
+ if isinstance(dut, Dut):
862
+ duts.append(dut)
863
+
864
+ return duts
@@ -1398,10 +1398,18 @@ class PytestEmbedded:
1398
1398
 
1399
1399
  @pytest.hookimpl(trylast=True)
1400
1400
  def pytest_runtest_call(self, item: Function):
1401
- # raise dut failed cases
1401
+ all_duts: list[Dut] = []
1402
+
1403
+ # Check DUTs created by fixture
1402
1404
  if 'dut' in item.funcargs:
1403
- duts = [dut for dut in to_list(item.funcargs['dut']) if isinstance(dut, Dut)]
1404
- self._raise_dut_failed_cases_if_exists(duts) # type: ignore
1405
+ fixture_duts = [dut for dut in to_list(item.funcargs['dut']) if isinstance(dut, Dut)]
1406
+ all_duts.extend(fixture_duts)
1407
+
1408
+ # Check DUTs created by DutFactory
1409
+ factory_duts = DutFactory.get_all_duts()
1410
+ all_duts.extend(factory_duts)
1411
+
1412
+ self._raise_dut_failed_cases_if_exists(all_duts) # type: ignore
1405
1413
 
1406
1414
  @pytest.hookimpl(trylast=True) # combine all possible junit reports should be the last step
1407
1415
  def pytest_sessionfinish(self, session: Session, exitstatus: int) -> None: