]> granicus.if.org Git - python/commitdiff
Do a little more searching for the data file for the test: this allows
authorFred Drake <fdrake@acm.org>
Tue, 22 Apr 2003 18:15:05 +0000 (18:15 +0000)
committerFred Drake <fdrake@acm.org>
Tue, 22 Apr 2003 18:15:05 +0000 (18:15 +0000)
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.

Lib/test/test_normalization.py

index 7e18c973ffa616aa86cc4da2d4ba60df09903dd9..94d07d524d43d5ac786f0b9abdc6172deb865661 100644 (file)
@@ -4,7 +4,18 @@ import os
 from unicodedata import normalize
 
 TESTDATAFILE = "NormalizationTest.txt"
-skip_expected = not os.path.exists(TESTDATAFILE)
+
+# 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
 
 class RangeError:
     pass