mirror of
https://github.com/python/cpython.git
synced 2025-11-03 19:34:08 +00:00
Print periodic "still working" messages since this suite is slow.
This commit is contained in:
parent
8250fbeac6
commit
41ada16cb7
1 changed files with 26 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
Run all test cases.
|
Run all test cases.
|
||||||
"""
|
"""
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
from test.test_support import requires, verbose, run_unittest, unlink
|
from test.test_support import requires, verbose, run_unittest, unlink
|
||||||
|
|
||||||
|
|
@ -21,6 +22,30 @@ if 'silent' in sys.argv: # take care of old flag, just in case
|
||||||
sys.argv.remove('silent')
|
sys.argv.remove('silent')
|
||||||
|
|
||||||
|
|
||||||
|
class TimingCheck(unittest.TestCase):
|
||||||
|
|
||||||
|
"""This class is not a real test. Its purpose is to print a message
|
||||||
|
periodically when the test runs slowly. This will prevent the buildbots
|
||||||
|
from timing out on slow machines."""
|
||||||
|
|
||||||
|
# How much time in seconds before printing a 'Still working' message.
|
||||||
|
# Since this is run at most once between each test module, use a smaller
|
||||||
|
# interval than other tests.
|
||||||
|
_PRINT_WORKING_MSG_INTERVAL = 4 * 60
|
||||||
|
|
||||||
|
# next_time is used as a global variable that survives each instance.
|
||||||
|
# This is necessary since a new instance will be created for each test.
|
||||||
|
next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
|
||||||
|
|
||||||
|
def testCheckElapsedTime(self):
|
||||||
|
# Print still working message since these tests can be really slow.
|
||||||
|
now = time.time()
|
||||||
|
if self.next_time <= now:
|
||||||
|
TimingCheck.next_time = now + self._PRINT_WORKING_MSG_INTERVAL
|
||||||
|
sys.__stdout__.write(' test_bsddb3 still working, be patient...\n')
|
||||||
|
sys.__stdout__.flush()
|
||||||
|
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
try:
|
try:
|
||||||
# this is special, it used to segfault the interpreter
|
# this is special, it used to segfault the interpreter
|
||||||
|
|
@ -53,6 +78,7 @@ def suite():
|
||||||
module = __import__("bsddb.test."+name, globals(), locals(), name)
|
module = __import__("bsddb.test."+name, globals(), locals(), name)
|
||||||
#print module,name
|
#print module,name
|
||||||
alltests.addTest(module.test_suite())
|
alltests.addTest(module.test_suite())
|
||||||
|
alltests.addTest(unittest.makeSuite(TimingCheck))
|
||||||
return alltests
|
return alltests
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue