@@ -226,29 +226,30 @@ def f():
226226 err )
227227
228228 def test_getwindowsversion (self ):
229- if hasattr (sys , "getwindowsversion" ):
230- v = sys .getwindowsversion ()
231- self .assertEqual (len (v ), 5 )
232- self .assertIsInstance (v [0 ], int )
233- self .assertIsInstance (v [1 ], int )
234- self .assertIsInstance (v [2 ], int )
235- self .assertIsInstance (v [3 ], int )
236- self .assertIsInstance (v [4 ], str )
237- self .assertRaises (IndexError , operator .getitem , v , 5 )
238- self .assertIsInstance (v .major , int )
239- self .assertIsInstance (v .minor , int )
240- self .assertIsInstance (v .build , int )
241- self .assertIsInstance (v .platform , int )
242- self .assertIsInstance (v .service_pack , str )
243- self .assertEqual (v [0 ], v .major )
244- self .assertEqual (v [1 ], v .minor )
245- self .assertEqual (v [2 ], v .build )
246- self .assertEqual (v [3 ], v .platform )
247- self .assertEqual (v [4 ], v .service_pack )
248-
249- # This is how platform.py calls it. Make sure tuple
250- # still has 5 elements
251- maj , min , buildno , plat , csd = sys .getwindowsversion ()
229+ # Raise SkipTest if sys doesn't have getwindowsversion attribute
230+ test .test_support .get_attribute (sys , "getwindowsversion" )
231+ v = sys .getwindowsversion ()
232+ self .assertEqual (len (v ), 5 )
233+ self .assertIsInstance (v [0 ], int )
234+ self .assertIsInstance (v [1 ], int )
235+ self .assertIsInstance (v [2 ], int )
236+ self .assertIsInstance (v [3 ], int )
237+ self .assertIsInstance (v [4 ], str )
238+ self .assertRaises (IndexError , operator .getitem , v , 5 )
239+ self .assertIsInstance (v .major , int )
240+ self .assertIsInstance (v .minor , int )
241+ self .assertIsInstance (v .build , int )
242+ self .assertIsInstance (v .platform , int )
243+ self .assertIsInstance (v .service_pack , str )
244+ self .assertEqual (v [0 ], v .major )
245+ self .assertEqual (v [1 ], v .minor )
246+ self .assertEqual (v [2 ], v .build )
247+ self .assertEqual (v [3 ], v .platform )
248+ self .assertEqual (v [4 ], v .service_pack )
249+
250+ # This is how platform.py calls it. Make sure tuple
251+ # still has 5 elements
252+ maj , min , buildno , plat , csd = sys .getwindowsversion ()
252253
253254 def test_call_tracing (self ):
254255 self .assertRaises (TypeError , sys .call_tracing , type , 2 )
0 commit comments