[Python-checkins] r76036 - in python/branches/py3k: Lib/test/test_normalization.py

antoine.pitrou python-checkins at python.org
Sun Nov 1 22:43:21 CET 2009


Author: antoine.pitrou
Date: Sun Nov  1 22:43:20 2009
New Revision: 76036

Log:
Merged revisions 76033 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76033 | antoine.pitrou | 2009-11-01 22:26:14 +0100 (dim., 01 nov. 2009) | 3 lines
  
  test_normalization should skip and not crash when the resource isn't available
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/test/test_normalization.py

Modified: python/branches/py3k/Lib/test/test_normalization.py
==============================================================================
--- python/branches/py3k/Lib/test/test_normalization.py	(original)
+++ python/branches/py3k/Lib/test/test_normalization.py	Sun Nov  1 22:43:20 2009
@@ -42,6 +42,11 @@
 class NormalizationTest(unittest.TestCase):
     def test_main(self):
         part1_data = {}
+        # Hit the exception early
+        try:
+            open_urlresource(TESTDATAURL, encoding="utf-8")
+        except IOError:
+            self.skipTest("Could not retrieve " + TESTDATAURL)
         for line in open_urlresource(TESTDATAURL, encoding="utf-8"):
             if '#' in line:
                 line = line.split('#')[0]
@@ -97,8 +102,6 @@
 
 
 def test_main():
-    # Skip the test early if the 'urlfetch' resource is not enabled.
-    open_urlresource(TESTDATAURL)
     run_unittest(NormalizationTest)
 
 if __name__ == "__main__":


More information about the Python-checkins mailing list