1+ from __future__ import annotations
2+
13import pytest
24
35import logging
@@ -41,7 +43,7 @@ def run_xenclean(vm: VM, guest_tools_iso: Dict[str, Any], onboard: Literal[True]
4143 ...
4244
4345
44- def run_xenclean (vm : VM , guest_tools_iso : Dict [str , Any ], onboard : bool = False ):
46+ def run_xenclean (vm : VM , guest_tools_iso : Dict [str , Any ], onboard : bool = False ) -> str | None :
4547 """
4648 Run XenClean from the provided guest tools.
4749
@@ -80,10 +82,12 @@ def run_xenclean(vm: VM, guest_tools_iso: Dict[str, Any], onboard: bool = False)
8082 onboarding_phase = ONBOARDING_PHASES [int (exitcode )]
8183 logging .info (f"Onboarding phase: { onboarding_phase } " )
8284 return onboarding_phase
85+ else :
86+ return None
8387
8488
8589@pytest .fixture (scope = "module" )
86- def onboarding_guest_tools_iso (guest_tools_iso ) :
90+ def onboarding_guest_tools_iso (guest_tools_iso : Dict [ str , Any ]) -> Dict [ str , Any ] :
8791 if not guest_tools_iso .get ("onboard_family" ):
8892 pytest .skip ("Onboarding info not declared in data.py" )
8993 return guest_tools_iso
@@ -92,24 +96,30 @@ def onboarding_guest_tools_iso(guest_tools_iso):
9296@pytest .mark .multi_vms
9397@pytest .mark .usefixtures ("windows_vm" )
9498class TestXenClean :
95- def test_xenclean_without_tools (self , running_unsealed_windows_vm : VM , guest_tools_iso ):
99+ def test_xenclean_without_tools (
100+ self , running_unsealed_windows_vm : VM , guest_tools_iso : Dict [str , Any ]
101+ ) -> None :
96102 vm = running_unsealed_windows_vm
97103 logging .info ("XenClean with empty VM" )
98104 run_xenclean (vm , guest_tools_iso )
99105 assert vm .are_windows_tools_uninstalled ()
100106
101- def test_xenclean_onboard_without_tools (self , running_unsealed_windows_vm : VM , onboarding_guest_tools_iso ):
107+ def test_xenclean_onboard_without_tools (self , running_unsealed_windows_vm : VM ,
108+ onboarding_guest_tools_iso : Dict [str , Any ]) -> None :
102109 vm = running_unsealed_windows_vm
103110 logging .info ("XenClean onboard with empty VM" )
104111 assert run_xenclean (vm , onboarding_guest_tools_iso , onboard = True ) == "ReadyForOnboard"
105112
106- def test_xenclean_with_test_tools_early (self , vm_install_test_tools_no_reboot : VM , guest_tools_iso ):
113+ def test_xenclean_with_test_tools_early (
114+ self , vm_install_test_tools_no_reboot : VM , guest_tools_iso : Dict [str , Any ]
115+ ) -> None :
107116 vm = vm_install_test_tools_no_reboot
108117 logging .info ("XenClean with test tools (without reboot)" )
109118 run_xenclean (vm , guest_tools_iso )
110119 assert vm .are_windows_tools_uninstalled ()
111120
112- def test_xenclean_with_test_tools (self , vm_install_test_tools_no_reboot : VM , guest_tools_iso ):
121+ def test_xenclean_with_test_tools (self , vm_install_test_tools_no_reboot : VM ,
122+ guest_tools_iso : Dict [str , Any ]) -> None :
113123 vm = vm_install_test_tools_no_reboot
114124 vm .reboot ()
115125 # HACK: In some cases, vm.reboot(verify=False) followed by vm.insert_cd() (as called by run_xenclean)
@@ -123,7 +133,8 @@ def test_xenclean_with_test_tools(self, vm_install_test_tools_no_reboot: VM, gue
123133 assert vm .are_windows_tools_uninstalled ()
124134 check_vm_dns (vm )
125135
126- def test_xenclean_onboard_with_test_tools (self , vm_install_test_tools_no_reboot : VM , onboarding_guest_tools_iso ):
136+ def test_xenclean_onboard_with_test_tools (self , vm_install_test_tools_no_reboot : VM ,
137+ onboarding_guest_tools_iso : Dict [str , Any ]) -> None :
127138 vm = vm_install_test_tools_no_reboot
128139 vm .reboot ()
129140 wait_for_vm_running_and_ssh_up_without_tools (vm )
@@ -133,7 +144,9 @@ def test_xenclean_onboard_with_test_tools(self, vm_install_test_tools_no_reboot:
133144 logging .info ("Check tools still working" )
134145 assert vm .are_windows_tools_working ()
135146
136- def test_xenclean_with_other_tools (self , vm_install_other_drivers : Tuple [VM , Dict ], guest_tools_iso ):
147+ def test_xenclean_with_other_tools (
148+ self , vm_install_other_drivers : Tuple [VM , Dict [str , Any ]], guest_tools_iso : Dict [str , Any ]
149+ ) -> None :
137150 vm , param = vm_install_other_drivers
138151 if param .get ("vendor_device" ):
139152 pytest .skip ("Skipping XenClean with vendor device present" )
@@ -146,8 +159,8 @@ def test_xenclean_with_other_tools(self, vm_install_other_drivers: Tuple[VM, Dic
146159 check_vm_dns (vm )
147160
148161 def test_xenclean_onboard_with_other_tools (
149- self , vm_install_other_drivers : Tuple [VM , Dict ] , onboarding_guest_tools_iso
150- ):
162+ self , vm_install_other_drivers : Tuple [VM , Dict [ str , Any ]] , onboarding_guest_tools_iso : Dict [ str , Any ]
163+ ) -> None :
151164 vm , param = vm_install_other_drivers
152165 onboarding_phase = param .get ("onboarding_phase" )
153166 if not param .get ("onboarding_phase" ):
0 commit comments