summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-09-02 19:40:19 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-09-02 19:40:19 (GMT)
commitc1120b4b667b1231eb2a57bd31de4b6c0572100a (patch)
tree9d958e84f3031ce5a8faf4a812eaa7e21e55612d /Lib/test
parent681d86743c21773bb00508dbacb05ed9012388d8 (diff)
downloadcpython-c1120b4b667b1231eb2a57bd31de4b6c0572100a.zip
cpython-c1120b4b667b1231eb2a57bd31de4b6c0572100a.tar.gz
cpython-c1120b4b667b1231eb2a57bd31de4b6c0572100a.tar.bz2
Hmm, this test has failed at least twice recently on the OpenBSD and
Debian sparc buildbots. Since this goes through a lot of tests and hits the disk a lot it could be slow (especially if NFS is involved). I'm not sure if that's the problem, but printing periodic msgs shouldn't hurt. The code was stolen from test_compiler.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_tokenize.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py
index 3fa7927..be6c18d 100644
--- a/Lib/test/test_tokenize.py
+++ b/Lib/test/test_tokenize.py
@@ -79,13 +79,16 @@ if (x # The comments need to go in the right place
"""
-import os, glob, random
+import os, glob, random, time, sys
from cStringIO import StringIO
from test.test_support import (verbose, findfile, is_resource_enabled,
TestFailed)
from tokenize import (tokenize, generate_tokens, untokenize, tok_name,
ENDMARKER, NUMBER, NAME, OP, STRING, COMMENT)
+# How much time in seconds can pass before we print a 'Still working' message.
+_PRINT_WORKING_MSG_INTERVAL = 5 * 60
+
# Test roundtrip for `untokenize`. `f` is a file path. The source code in f
# is tokenized, converted back to source code via tokenize.untokenize(),
# and tokenized again from the latter. The test fails if the second
@@ -164,6 +167,8 @@ def test_main():
if verbose:
print 'starting...'
+ next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
+
# This displays the tokenization of tokenize_tests.py to stdout, and
# regrtest.py checks that this equals the expected output (in the
# test/output/ directory).
@@ -183,6 +188,12 @@ def test_main():
testfiles = random.sample(testfiles, 10)
for f in testfiles:
+ # Print still working message since this test can be really slow
+ if next_time <= time.time():
+ next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
+ print >>sys.__stdout__, ' test_main still working, be patient...'
+ sys.__stdout__.flush()
+
test_roundtrip(f)
# Test detecton of IndentationError.