[Python-checkins] r74154 - python/branches/py3k/Lib/test/test_normalization.py

alexandre.vassalotti python-checkins at python.org
Wed Jul 22 02:30:24 CEST 2009


Author: alexandre.vassalotti
Date: Wed Jul 22 02:30:24 2009
New Revision: 74154
Log:
Make test_normalization verify the version of the correct test data file.
Modified:
 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	Wed Jul 22 02:30:24 2009
@@ -8,12 +8,14 @@
 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 @@
 
 
 def test_main():
- # Hit the exception early
+ # Skip the test early if the 'urlfetch' resource is not enabled.
 open_urlresource(TESTDATAURL)
 run_unittest(NormalizationTest)
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /