]> granicus.if.org Git - python/commitdiff
test_normalization should skip and not crash when the resource isn't available
authorAntoine Pitrou <solipsis@pitrou.net>
Sun, 1 Nov 2009 21:26:14 +0000 (21:26 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Sun, 1 Nov 2009 21:26:14 +0000 (21:26 +0000)
Lib/test/test_normalization.py

index 0eea4bfc4ec69dc8ee85676ec788e9c57d984c60..6a7574143fd97cb83c5ea3d61cc994b713a300d0 100644 (file)
@@ -40,6 +40,11 @@ def unistr(data):
 class NormalizationTest(unittest.TestCase):
     def test_main(self):
         part1_data = {}
+        # Hit the exception early
+        try:
+            open_urlresource(TESTDATAURL)
+        except IOError:
+            self.skipTest("Could not retrieve " + TESTDATAURL)
         for line in open_urlresource(TESTDATAURL):
             if '#' in line:
                 line = line.split('#')[0]
@@ -95,8 +100,6 @@ class NormalizationTest(unittest.TestCase):
 
 
 def test_main():
-    # Hit the exception early
-    open_urlresource(TESTDATAURL)
     run_unittest(NormalizationTest)
 
 if __name__ == "__main__":