Title: test_normalization fails when NormalizationTest.txt is outdated
Type: behavior Stage: resolved
Components: Tests, Unicode Versions: Python 3.2, Python 2.7
Status: closed Resolution: fixed
Dependencies: 7787 Superseder:
Assigned To: Nosy List: ezio.melotti, flox
Priority: normal Keywords: patch

Created on 2010-01-26 08:21 by flox, last changed 2010-03-21 14:36 by ezio.melotti. This issue is now closed.

File name Uploaded Description Edit
issue7783_normalization_v2.diff flox, 2010-01-26 20:38 Patch, apply to trunk
Messages (4)
msg98321 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-26 08:21
The test "test_normalization" download a file from the "" website and keep it in the local cache "Lib/test/data/" directory for next runs.
On test setup, it verifies if the 1st line contains the right version "unicodedata.unidata_version".
It should unlink the file if it is outdated.
But it does not work as expected: it looks for the file in the wrong directory.

~ $ echo "# NormalizationTest-3.0.0.txt ~ outdated version" > Lib/test/data/NormalizationTest.txt

~ $ ./python -m test.regrtest -uall test_normalization
test test_normalization failed -- Traceback (most recent call last):
  File "./Lib/test/", line 96, in test_main
    self.assertTrue(X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X), c)
AssertionError: 160

1 test failed:

~ $ cat Lib/test/data/NormalizationTest.txt
# NormalizationTest-3.0.0.txt ~ outdated version
msg98322 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-26 08:30
Here is a patch.

The function "test_support.open_urlresource" is enhanced with an optional argument "check" which receives a function. This "check" function accepts an open file as input and return False if the file is outdated.
msg98378 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-26 20:37
Now the fix depends on #7787
msg101131 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-03-15 18:19
Done with r78986.
Date User Action Args
2010-03-21 14:36:54ezio.melottisetnosy: + ezio.melotti
2010-03-15 18:19:21floxsetstatus: open -> closed
priority: normal
resolution: fixed
stage: patch review -> resolved
2010-03-15 18:19:06floxsetmessages: + msg101131
2010-02-26 16:01:12floxlinkissue8024 dependencies
2010-01-26 20:38:27floxsetfiles: + issue7783_normalization_v2.diff
2010-01-26 20:38:08floxsetfiles: - issue7787_urlresource.diff
2010-01-26 20:37:41floxsetfiles: + issue7787_urlresource.diff

dependencies: + Add an argument to test_support.open_urlresource to invalidate the cache
messages: + msg98378
stage: patch review
2010-01-26 20:36:53floxsetfiles: - issue7783_normalization.diff
2010-01-26 08:30:50floxsetfiles: + issue7783_normalization.diff
keywords: + patch
messages: + msg98322

versions: + Python 3.2
2010-01-26 08:21:34floxcreate