@@ -242,13 +242,10 @@ def test_hook_executable_exists(self, hook_configs, hook_name):
242242 # If absolute path fails, try relative to config file
243243 hook_path = config_path .parent / hook_path .name
244244
245- # Special case: seat manager uses the shared device manager executable
245+ # Special case: seat manager uses shared device manager executable
246246 if not hook_path .exists () and hook_name == "oci-qm-seat-manager" :
247- hook_path = (
248- config_path .parent .parent
249- / "qm-device-manager"
250- / hook_path .name
251- )
247+ parent_dir = config_path .parent .parent
248+ hook_path = parent_dir / "qm-device-manager" / hook_path .name
252249
253250 assert hook_path .exists (), f"Hook executable not found: { hook_path } "
254251 assert hook_path .is_file (), f"Hook executable not a file: { hook_path } "
@@ -404,16 +401,13 @@ def test_hook_config_integration(self, hook_configs, hook_name):
404401 # If absolute path fails, try relative to config directory
405402 full_hook_path = config_path .parent / Path (hook_path ).name
406403
407- # Special case: seat manager uses the shared device manager executable
408- if (
409- not full_hook_path .exists ()
410- and hook_name == "oci-qm-seat-manager"
411- ):
412- full_hook_path = (
413- config_path .parent .parent
414- / "qm-device-manager"
415- / Path (hook_path ).name
416- )
404+ # Special case: seat manager uses shared device manager executable
405+ is_seat_manager = hook_name == "oci-qm-seat-manager"
406+ if not full_hook_path .exists () and is_seat_manager :
407+ parent_dir = config_path .parent .parent
408+ hook_name_path = Path (hook_path ).name
409+ device_mgr_dir = parent_dir / "qm-device-manager"
410+ full_hook_path = device_mgr_dir / hook_name_path
417411
418412 # Check that executable exists
419413 assert full_hook_path .exists (), (
0 commit comments