1717# CI jobs that need OVPhysX coverage install it explicitly.
1818pytest .importorskip ("ovphysx.types" , reason = "ovphysx wheel not installed" )
1919
20+ _LEGACY_LIFECYCLE_ENTRY_POINTS = {"warmup" : "warmup_gpu" , "destroy" : "release" }
21+ _CURRENT_LIFECYCLE_ENTRY_POINTS = {"warmup" : "warmup" , "destroy" : "destroy" }
22+
2023
2124@pytest .fixture (autouse = True )
2225def _close_test_views ():
@@ -467,6 +470,7 @@ def test_manager_attaches_and_releases_owned_ovstage(monkeypatch):
467470 from isaaclab_ov .physics import OvPhysxManager
468471
469472 events = []
473+ monkeypatch .setattr (om_mod , "OVPHYSX_LIFECYCLE_ENTRY_POINTS" , _LEGACY_LIFECYCLE_ENTRY_POINTS )
470474
471475 class FakeWriteFloorOp :
472476 def __init__ (self , ordinal ):
@@ -544,92 +548,44 @@ def release(self):
544548 ]
545549
546550
547- def test_manager_uses_current_warmup_api (monkeypatch ):
548- """The version-selected current warmup API wins when both methods are visible."""
549- from isaaclab_ov .physics import OvPhysxManager
550- from isaaclab_ov .physics import ovphysx_manager as om_mod
551-
552- calls = []
553- physx = SimpleNamespace (
554- warmup = lambda : calls .append ("warmup" ),
555- warmup_gpu = lambda : calls .append ("warmup_gpu" ),
556- )
557- monkeypatch .setattr (om_mod , "OVPHYSX_LIFECYCLE_ENTRY_POINTS" , {"warmup" : "warmup" , "destroy" : "destroy" })
558-
559- OvPhysxManager ._warmup_physx (physx )
560-
561- assert calls == ["warmup" ]
562-
563-
564- def test_manager_uses_legacy_warmup_api (monkeypatch ):
565- """The version-selected 0.5.11 path uses the legacy method even if both are visible."""
551+ @pytest .mark .parametrize (
552+ ("entry_points" , "expected_calls" ),
553+ [
554+ (_LEGACY_LIFECYCLE_ENTRY_POINTS , ["warmup_gpu" , "release" ]),
555+ (_CURRENT_LIFECYCLE_ENTRY_POINTS , ["warmup" , "destroy" ]),
556+ ],
557+ )
558+ def test_manager_uses_version_selected_lifecycle_apis (monkeypatch , entry_points , expected_calls ):
559+ """The selected lifecycle generation controls both entry points."""
566560 from isaaclab_ov .physics import OvPhysxManager
567561 from isaaclab_ov .physics import ovphysx_manager as om_mod
568562
569563 calls = []
570564 physx = SimpleNamespace (
571565 warmup = lambda : calls .append ("warmup" ),
572566 warmup_gpu = lambda : calls .append ("warmup_gpu" ),
573- )
574- monkeypatch .setattr (om_mod , "OVPHYSX_LIFECYCLE_ENTRY_POINTS" , {"warmup" : "warmup_gpu" , "destroy" : "release" })
575-
576- OvPhysxManager ._warmup_physx (physx )
577-
578- assert calls == ["warmup_gpu" ]
579-
580-
581- def test_manager_rejects_missing_warmup_api (monkeypatch ):
582- """A runtime that lacks its version-selected warmup entry point reports it."""
583- from isaaclab_ov .physics import OvPhysxManager
584- from isaaclab_ov .physics import ovphysx_manager as om_mod
585-
586- monkeypatch .setattr (om_mod , "OVPHYSX_LIFECYCLE_ENTRY_POINTS" , {"warmup" : "warmup" , "destroy" : "destroy" })
587- with pytest .raises (AttributeError , match = r"selected warmup\(\) lifecycle entry point" ):
588- OvPhysxManager ._warmup_physx (SimpleNamespace ())
589-
590-
591- def test_manager_uses_current_destroy_api (monkeypatch ):
592- """A current OVPhysX runtime tears down through destroy()."""
593- from isaaclab_ov .physics import OvPhysxManager
594- from isaaclab_ov .physics import ovphysx_manager as om_mod
595-
596- calls = []
597- physx = SimpleNamespace (
598567 destroy = lambda : calls .append ("destroy" ),
599568 release = lambda : calls .append ("release" ),
600569 )
601- monkeypatch .setattr (om_mod , "OVPHYSX_LIFECYCLE_ENTRY_POINTS" , {"warmup" : "warmup" , "destroy" : "destroy" })
602-
603- OvPhysxManager ._destroy_physx (physx )
604-
605- assert calls == ["destroy" ]
606-
607-
608- def test_manager_uses_legacy_release_api (monkeypatch ):
609- """The version-selected 0.5.11 path uses release() even if both methods are visible."""
610- from isaaclab_ov .physics import OvPhysxManager
611- from isaaclab_ov .physics import ovphysx_manager as om_mod
612-
613- calls = []
614- physx = SimpleNamespace (
615- destroy = lambda : calls .append ("destroy" ),
616- release = lambda : calls .append ("release" ),
617- )
618- monkeypatch .setattr (om_mod , "OVPHYSX_LIFECYCLE_ENTRY_POINTS" , {"warmup" : "warmup_gpu" , "destroy" : "release" })
570+ monkeypatch .setattr (om_mod , "OVPHYSX_LIFECYCLE_ENTRY_POINTS" , entry_points )
619571
572+ OvPhysxManager ._warmup_physx (physx )
620573 OvPhysxManager ._destroy_physx (physx )
621574
622- assert calls == [ "release" ]
575+ assert calls == expected_calls
623576
624577
625- def test_manager_rejects_missing_destroy_api (monkeypatch ):
626- """A runtime that lacks its version-selected destroy entry point reports it."""
578+ @pytest .mark .parametrize ("operation" , ["warmup" , "destroy" ])
579+ def test_manager_rejects_missing_lifecycle_api (monkeypatch , operation ):
580+ """A runtime that lacks its selected lifecycle entry point reports it."""
627581 from isaaclab_ov .physics import OvPhysxManager
628582 from isaaclab_ov .physics import ovphysx_manager as om_mod
629583
630- monkeypatch .setattr (om_mod , "OVPHYSX_LIFECYCLE_ENTRY_POINTS" , {"warmup" : "warmup" , "destroy" : "destroy" })
631- with pytest .raises (AttributeError , match = r"selected destroy\(\) lifecycle entry point" ):
632- OvPhysxManager ._destroy_physx (SimpleNamespace ())
584+ monkeypatch .setattr (om_mod , "OVPHYSX_LIFECYCLE_ENTRY_POINTS" , _CURRENT_LIFECYCLE_ENTRY_POINTS )
585+ entry_point = _CURRENT_LIFECYCLE_ENTRY_POINTS [operation ]
586+ lifecycle_method = getattr (OvPhysxManager , f"_{ operation } _physx" )
587+ with pytest .raises (AttributeError , match = rf"selected { entry_point } \(\) lifecycle entry point" ):
588+ lifecycle_method (SimpleNamespace ())
633589
634590
635591def test_manager_releases_legacy_owners_after_release_error (monkeypatch ):
@@ -638,7 +594,7 @@ def test_manager_releases_legacy_owners_after_release_error(monkeypatch):
638594 from isaaclab_ov .physics import ovphysx_manager as om_mod
639595
640596 events = []
641- monkeypatch .setattr (om_mod , "OVPHYSX_LIFECYCLE_ENTRY_POINTS" , { "warmup" : "warmup_gpu" , "destroy" : "release" } )
597+ monkeypatch .setattr (om_mod , "OVPHYSX_LIFECYCLE_ENTRY_POINTS" , _LEGACY_LIFECYCLE_ENTRY_POINTS )
642598
643599 class FakePhysX :
644600 def reset_stage (self ):
@@ -679,7 +635,7 @@ def test_manager_retries_current_destroy_before_releasing_owners(monkeypatch):
679635 from isaaclab_ov .physics import ovphysx_manager as om_mod
680636
681637 events = []
682- monkeypatch .setattr (om_mod , "OVPHYSX_LIFECYCLE_ENTRY_POINTS" , { "warmup" : "warmup" , "destroy" : "destroy" } )
638+ monkeypatch .setattr (om_mod , "OVPHYSX_LIFECYCLE_ENTRY_POINTS" , _CURRENT_LIFECYCLE_ENTRY_POINTS )
683639
684640 class FakePhysX :
685641 fail_destroy = True
@@ -745,7 +701,7 @@ def test_manager_releases_owners_after_terminal_destroy_error(monkeypatch):
745701 from isaaclab_ov .physics import ovphysx_manager as om_mod
746702
747703 events = []
748- monkeypatch .setattr (om_mod , "OVPHYSX_LIFECYCLE_ENTRY_POINTS" , { "warmup" : "warmup" , "destroy" : "destroy" } )
704+ monkeypatch .setattr (om_mod , "OVPHYSX_LIFECYCLE_ENTRY_POINTS" , _CURRENT_LIFECYCLE_ENTRY_POINTS )
749705
750706 class FakePhysX :
751707 terminal = False
0 commit comments