[pypy-svn] r11625 - pypy/dist/lib-python-2.3.4/test
hpk at codespeak.net
hpk at codespeak.net
Fri Apr 29 16:15:15 CEST 2005
Author: hpk
Date: Fri Apr 29 16:15:15 2005
New Revision: 11625
Modified:
pypy/dist/lib-python-2.3.4/test/conftest.py
Log:
allow to specify timeouts in 'megapystones',
default is 100MP now: the number of seconds
equivalent to running 100 Million Pystones
(around 900 seconds on codespeak.net).
example:
py.test -T 1000mp
Modified: pypy/dist/lib-python-2.3.4/test/conftest.py
==============================================================================
--- pypy/dist/lib-python-2.3.4/test/conftest.py (original)
+++ pypy/dist/lib-python-2.3.4/test/conftest.py Fri Apr 29 16:15:15 2005
@@ -10,6 +10,7 @@
# the following adds command line options as a side effect!
from pypy.conftest import gettestobjspace, option as pypy_option
from test.regrtest import reportdiff
+from test import pystone
#
# Interfacing/Integrating with py.test's collection process
@@ -29,11 +30,22 @@
Option('-E', '--extracttests', action="store_true",
default=False, dest="extracttests",
help="try to extract single tests and run them via py.test/PyPy"),
- Option('-T', '--timeout', action="store", type="int",
- default=15*60, dest="timeout",
- help="timeout running of a test module (default 15*60 seconds)"),
+ Option('-T', '--timeout', action="store", type="string",
+ default="100mp", dest="timeout",
+ help="fail a test module after the given timeout. "
+ "specify in seconds or 'XXXmp' aka Mega-Pystones")
)
+def gettimeout():
+ timeout = option.timeout.lower()
+ if timeout.endswith('mp'):
+ megapystone = float(timeout[:-2])
+ t, stone = pystone.Proc0(10000)
+ pystonetime = t/stone
+ seconds = megapystone * 1000000 * pystonetime
+ return seconds
+ return float(timeout)
+
mydir = py.magic.autopath().dirpath()
pypydir = py.path.local(pypy.__file__).dirpath()
@@ -732,9 +744,9 @@
if regrtest.oldstyle or pypy_option.oldstyle:
pypy_options.append('--oldstyle')
sopt = " ".join(pypy_options)
- TIMEOUT = option.timeout
- cmd = "%s %s %d %s %s %s" %(python, alarm_script, TIMEOUT, pypy_script, sopt, fspath)
+ TIMEOUT = gettimeout()
+ cmd = "%s %s %d %s %s %s" %(python, alarm_script, TIMEOUT, pypy_script, sopt, fspath)
try:
username = getpass.getuser()
except:
@@ -771,6 +783,7 @@
print >> resultfile, "oldstyle:", regrtest.oldstyle and 'yes' or 'no'
print >> resultfile, 'pypy-revision:', getrev(pypydir)
print >> resultfile, "startdate:", time.ctime()
+ print >> resultfile, "timeout: %s seconds" %(TIMEOUT,)
print >> resultfile
if outputfilename:
More information about the Pypy-commit
mailing list