summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2009-07-22 00:30:24 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2009-07-22 00:30:24 (GMT)
commit4f1f422713358767de04642724ea4f96c6404f92 (patch)
treeaa25edf235cfa80d8e28daece1d8d4ce25458e53 /Lib/test
parentdf4ff08be41e2013b41f575d0a0ed61e74d4c0ad (diff)
downloadcpython-4f1f422713358767de04642724ea4f96c6404f92.zip
cpython-4f1f422713358767de04642724ea4f96c6404f92.tar.gz
cpython-4f1f422713358767de04642724ea4f96c6404f92.tar.bz2
Make test_normalization verify the version of the correct test data file.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_normalization.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/test_normalization.py b/Lib/test/test_normalization.py
index f92a714..94d65b8 100644
--- a/Lib/test/test_normalization.py
+++ b/Lib/test/test_normalization.py
@@ -8,12 +8,14 @@ from unicodedata import normalize, unidata_version
TESTDATAFILE = "NormalizationTest.txt"
TESTDATAURL = "http://www.unicode.org/Public/" + unidata_version + "/ucd/" + TESTDATAFILE
-if os.path.exists(TESTDATAFILE):
- f = open(TESTDATAFILE, encoding='utf-8')
+# Verify we have the correct version of the test data file.
+TESTDATAPATH = os.path.join(os.path.dirname(__file__), "data", TESTDATAFILE)
+if os.path.exists(TESTDATAPATH):
+ f = open(TESTDATAPATH, encoding='utf-8')
l = f.readline()
f.close()
if not unidata_version in l:
- os.unlink(TESTDATAFILE)
+ os.unlink(testdatafile)
class RangeError(Exception):
pass
@@ -95,7 +97,7 @@ class NormalizationTest(unittest.TestCase):
def test_main():
- # Hit the exception early
+ # Skip the test early if the 'urlfetch' resource is not enabled.
open_urlresource(TESTDATAURL)
run_unittest(NormalizationTest)