Mathics icon indicating copy to clipboard operation
Mathics copied to clipboard

TimeConstrained fails on MacOSX, MS Windows and Python 3.8

Open rocky opened this issue 4 years ago • 0 comments

From https://github.com/mathics/Mathics/runs/1754026358

   def test_timeconstrained1():
        #
        str_expr1 = "a=1.; TimeConstrained[Do[Pause[.1];a=a+1,{1000}],1]"
        result = session.evaluate(str_expr1)
        str_expected = "$Aborted"
        expected = session.evaluate(str_expected)
        assert result == expected
        time.sleep(1)
>       assert session.evaluate("a").to_python() == 10
E       AssertionError: assert 8.0 == 10
E        +  where 8.0 = <bound method MachineReal.to_python of <Real: 8.0>>()
E        +    where <bound method MachineReal.to_python of <Real: 8.0>> = <Real: 8.0>.to_python
E        +      where <Real: 8.0> = <bound method MathicsSession.evaluate of <mathics.session.MathicsSession object at 0x126ab8730>>('a')
E        +        where <bound method MathicsSession.evaluate of <mathics.session.MathicsSession object at 0x126ab8730>> = <mathics.session.MathicsSession object at 0x126ab8730>.evaluate

Even on GNU/Linux, TimeConstrained[] is fragile.

rocky avatar Jan 23 '21 13:01 rocky