Hi,

On 15 June 2011 15:53, Aaron Meurer <[email protected]> wrote:

> The problem is that I'll have to do this within each test function
> that uses this.  I'll use this idiom for now, but a cleaner one would
> be better.
>

Maybe lets add a decorator that will wrap test code in try: finally: block
and restore dps automatically?


>
> Aaron Meurer
>
> On Wed, Jun 15, 2011 at 1:26 PM, Mateusz Paprocki <[email protected]>
> wrote:
> > Hi,
> >
> > On 15 June 2011 21:11, Tom Bachmann <[email protected]> wrote:
> >>
> >> On 15.06.2011 20:08, Aaron Meurer wrote:
> >>>
> >>> The int cache test tests the integer cache, which is not the same
> >>> after a second execution (it tests that something is *not* in the
> >>> cache).  See http://code.google.com/p/sympy/issues/detail?id=1946.
> >>>
> >>> The mpmath test fails because test_lambdify.py sets mpmath.mp.dps,
> >>> which changes the precision globally.  Is there a way to use a
> >>> different precision in that test without changing it globally?
> >>>
> >>
> >> Isn't the common idiom to do
> >>
> >> oldprec = mpmath.dps
> >> mpmath.dps = ...
> >> ...
> >> mpmath.dps = oldprec
> >
> > The best way is to do:
> > dps = mpmath.dps
> > mpmath.dps = ...
> > try:
> >     ...
> > finally:
> >     mpmath.dps = dps
> > (until we will be able to use with statement in the library).
> >
> >>
> >> ?
> >>
> >>> Aaron Meurer
> >>>
> >>> On Wed, Jun 15, 2011 at 12:04 PM, Aaron Meurer<[email protected]>
> >>>  wrote:
> >>>>
> >>>> Regarding the last two, it seems that testing warnings is not as easy
> >>>> as I though.  To quote
> >>>> http://docs.python.org/library/warnings.html?highlight=warnings:
> >>>>
> >>>> "One thing to be aware of is that if a warning has already been raised
> >>>> because of a once/default rule, then no matter what filters are set
> >>>> the warning will not be seen again unless the warnings registry
> >>>> related to the warning has been cleared."
> >>>>
> >>>> I can't figure out how to actually reset this registry
> >>>> (warnings.resetwarnings() does not do it).  So I will XFAIL these
> >>>> tests and create an issue for this.
> >>>>
> >>>> Aaron Meurer
> >>>>
> >>>> On Wed, Jun 15, 2011 at 11:49 AM, Aaron Meurer<[email protected]>
> >>>>  wrote:
> >>>>>
> >>>>> Hi.
> >>>>>
> >>>>> Thanks for reporting this.  I think I can fix the bugs you give
> below,
> >>>>> but I don't think I can fix the Windows bugs without some help, as I
> >>>>> don't have Windows and can't reproduce those on my Mac.  Do you think
> >>>>> you could help me debug them?  If possible, pull in the latest 0.7.0
> >>>>> branch on Windows, because I'll be pushing in fixes for the below
> >>>>> errors there soon.
> >>>>>
> >>>>> Aaron Meurer
> >>>>>
> >>>>> On Wed, Jun 15, 2011 at 2:22 AM, Renato Coutinho
> >>>>> <[email protected]>  wrote:
> >>>>>>
> >>>>>> Hello,
> >>>>>>
> >>>>>> I just tested the new rc. In linux 64-bits using tox, all tests pass
> >>>>>> with python and gmpy ground types.
> >>>>>>
> >>>>>> In Windows XP, all tests pass with python 2.5-2.7. With python2.4 I
> >>>>>> get a lot of errors, and the test suite doesn't even finish. I
> >>>>>> uploaded the output to https://gist.github.com/1026644. I'm not
> sure
> >>>>>> if it's worthwhile to pursue all those errors though.
> >>>>>>
> >>>>>> I also noticed that caching introduces some errors. In python2.7 in
> >>>>>> linux, if I run sympy.test() twice in the same session, I get the
> >>>>>> errors below. Fortunately, none of the failures look too dangerous,
> >>>>>> but it shows caching does have some colateral effects.
> >>>>>>
> >>>>>> Renato
> >>>>>>
> >>>>>>
> >>>>>> _____________ sympy/core/tests/test_numbers.py:test_integers_cache
> >>>>>> _____________
> >>>>>>  File
> >>>>>>
> "/home/renato/down/sympy-0.7.0.rc2/sympy/core/tests/test_numbers.py",
> >>>>>> line 14, in test_integers_cache
> >>>>>>    value += 1
> >>>>>> UnboundLocalError: local variable 'value' referenced before
> assignment
> >>>>>>
> >>>>>>
> >>>>>>
> ________________________________________________________________________________
> >>>>>> _________
> sympy/assumptions/tests/test_query.py:test_key_extensibility
> >>>>>> _________
> >>>>>>  File
> >>>>>>
> "/home/renato/down/sympy-0.7.0.rc2/sympy/assumptions/tests/test_query.py",
> >>>>>> line 976, in test_key_extensibility
> >>>>>>    raises(AttributeError, "ask(Q.my_key(x))")
> >>>>>>  File "sympy/utilities/pytest.py", line 49, in raises
> >>>>>>    raise AssertionError("DID NOT RAISE")
> >>>>>> AssertionError: DID NOT RAISE
> >>>>>>
> >>>>>>
> ________________________________________________________________________________
> >>>>>> __________
> sympy/core/tests/test_numbers.py:test_conversion_to_mpmath
> >>>>>> __________
> >>>>>>  File
> >>>>>>
> "/home/renato/down/sympy-0.7.0.rc2/sympy/core/tests/test_numbers.py",
> >>>>>> line 703, in test_conversion_to_mpmath
> >>>>>>    assert mpmath.mpmathify(Float('1.23')) == mpmath.mpf('1.23')
> >>>>>> AssertionError
> >>>>>>
> >>>>>>
> ________________________________________________________________________________
> >>>>>> _________________ sympy/core/tests/test_symbol.py:test_symbols
> >>>>>> _________________
> >>>>>>  File
> >>>>>> "/home/renato/down/sympy-0.7.0.rc2/sympy/core/tests/test_symbol.py",
> >>>>>> line 123, in test_symbols
> >>>>>>    raises(DeprecationWarning, "symbols('xyz', each_char=True)")
> >>>>>>  File "sympy/utilities/pytest.py", line 49, in raises
> >>>>>>    raise AssertionError("DID NOT RAISE")
> >>>>>> AssertionError: DID NOT RAISE
> >>>>>>
> >>>>>>
> ________________________________________________________________________________
> >>>>>> ______________ sympy/geometry/tests/test_geometry.py:test_polygon
> >>>>>> ______________
> >>>>>>  File
> >>>>>>
> "/home/renato/down/sympy-0.7.0.rc2/sympy/geometry/tests/test_geometry.py",
> >>>>>> line 593, in test_polygon
> >>>>>>    raises(UserWarning, "p1.distance(p2)")
> >>>>>>  File "sympy/utilities/pytest.py", line 49, in raises
> >>>>>>    raise AssertionError("DID NOT RAISE")
> >>>>>> AssertionError: DID NOT RAISE
> >>>>>>
> >>>>>> --
> >>>>>> 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.
> >>>>>>
> >>>>>>
> >>>>>
> >>>>
> >>>
> >>
> >> --
> >> 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.
> >>
> >
> > Mateusz
> >
> > --
> > 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.
> >
>
> --
> 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.
>
>
Mateusz

-- 
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