On Wed, Jun 2, 2010 at 10:25 AM, Aaron S. Meurer <[email protected]> wrote:
> Does anyone know how to make a test that times out?  For my GSoC project, I 
> am gathering up all the failing integrals from the issues into a file of 
> XFAIL tests, so I can see if any of them ever pass.  The problem is that many 
> integrals fail not by traceback or by returning an unevaluated Integral, but 
> by simply hanging.  So is there a way that I can say, "if this test takes 
> longer than, say, a minute, then fail, but let it run that long in case it 
> might pass"?  Something like:
>
> @XFAIL
> def test_some_issue():
>        assert run_with_timeout("integrate(hard_integral, x)", 60) == 
> the_answer
>
> and run_with_timeout will return the result if it finishes in less than 60 
> seconds, or else raise some kind of exception.  I know that Goolge has 
> something like this underlying all Python executions in their AppEngine, but 
> I think it is in-house code.  For example, go to live.sympy.com and run:
>
> var('m n a b c')
> integrate((x**m * (1 - x)**n * (a + b*x + c*x**2))/(1 + x**2), x) # from 
> issue 1426
>
> And you will get DeadlineExceededError.

Yes, I think that one can use signals to do that, but I am not sure if
it's cross platform. See the example at the end of this page:

http://docs.python.org/library/signal.html

Ondrej

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to