fix: standardize provider interface parameters across all implementations
- Add screen_size parameter to get_vm_path() for all providers (with default 1920x1080) - Add os_type parameter to start_emulator() for Azure and VirtualBox providers - Add region parameter to stop_emulator() for VMware, Docker, and VirtualBox providers - Use *args, **kwargs for better extensibility and parameter consistency - Add documentation comments explaining ignored parameters for interface consistency - Prevents TypeError exceptions when AWS-specific parameters are passed to other providers This ensures all providers can handle the same parameter sets while maintaining backward compatibility and avoiding interface fragmentation.
This commit is contained in:
@@ -417,7 +417,9 @@ class VMwareVMManager(VMManager):
|
||||
free_vms.append((vm_path, pid_str))
|
||||
return free_vms
|
||||
|
||||
def get_vm_path(self, os_type, region=None):
|
||||
def get_vm_path(self, os_type, region=None, screen_size=(1920, 1080), **kwargs):
|
||||
# Note: screen_size parameter is ignored for VMware provider
|
||||
# but kept for interface consistency with other providers
|
||||
with self.lock:
|
||||
if not VMwareVMManager.checked_and_cleaned:
|
||||
VMwareVMManager.checked_and_cleaned = True
|
||||
|
||||
@@ -97,7 +97,9 @@ class VMwareProvider(Provider):
|
||||
time.sleep(WAIT_TIME) # Wait for the VM to revert
|
||||
return path_to_vm
|
||||
|
||||
def stop_emulator(self, path_to_vm: str):
|
||||
def stop_emulator(self, path_to_vm: str, region=None, *args, **kwargs):
|
||||
# Note: region parameter is ignored for VMware provider
|
||||
# but kept for interface consistency with other providers
|
||||
logger.info("Stopping VMware VM...")
|
||||
VMwareProvider._execute_command(["vmrun"] + get_vmrun_type(return_list=True) + ["stop", path_to_vm])
|
||||
time.sleep(WAIT_TIME) # Wait for the VM to stop
|
||||
|
||||
Reference in New Issue
Block a user