diff Lib/test/test_normalization.py @ 35998:96d1fa36964d legacy-trunk

Patch #1276356: Implement new resource "urlfetch" for regrtest. This enables even impatient people to run tests that require remote files such as test_normalization and test_codecmaps_*.
author Hye-Shik Chang <hyeshik@gmail.com>
date Sat, 10 Dec 2005 17:44:27 +0000
parents 04ca4d1f751f
children fab44c5c8df4
line wrap: on
line diff
--- a/Lib/test/test_normalization.py	Thu Dec 08 14:54:20 2005 +0000
+++ b/Lib/test/test_normalization.py	Sat Dec 10 17:44:27 2005 +0000
@@ -1,21 +1,11 @@
-from test.test_support import verbose, TestFailed, TestSkipped, verify
+from test.test_support import (verbose, TestFailed, TestSkipped, verify,
+                               open_urlresource)
 import sys
 import os
 from unicodedata import normalize
 
 TESTDATAFILE = "NormalizationTest-3.2.0" + os.extsep + "txt"
-
-# This search allows using a build directory just inside the source
-# directory, and saving just one copy of the test data in the source
-# tree, rather than having a copy in each build directory.
-# There might be a better way to do this.
-
-for path in [os.path.curdir, os.path.pardir]:
-    fn = os.path.join(path, TESTDATAFILE)
-    skip_expected = not os.path.exists(fn)
-    if not skip_expected:
-        TESTDATAFILE = fn
-        break
+TESTDATAURL = "http://www.unicode.org/Public/3.2-Update/" + TESTDATAFILE
 
 class RangeError:
     pass
@@ -40,12 +30,8 @@
     return u"".join([unichr(x) for x in data])
 
 def test_main():
-    if skip_expected:
-        raise TestSkipped(TESTDATAFILE + " not found, download from " +
-                    "http://www.unicode.org/Public/3.2-Update/" + TESTDATAFILE)
-
     part1_data = {}
-    for line in open(TESTDATAFILE):
+    for line in open_urlresource(TESTDATAURL):
         if '#' in line:
             line = line.split('#')[0]
         line = line.strip()