Traceback in doctests are very minimal, they wouldn't really have more 
information than the warning. And really we shouldn't test where the 
warning is coming from (thats imho an implementation detail), only that 
there is a warning emitted.

There is certainly a use case for getting a traceback from a warning, but I 
don't understand what you want that isn't handled by the standard

import warnings
warnings.filterwarnings('error')

 

On Monday, August 8, 2016 at 3:49:10 PM UTC+2, Jeroen Demeyer wrote:
>
> Hello, 
>
> I have often been annoyed by the lack of tracebacks given in warning 
> messages. Something, I have even replaced a warning with an exception, 
> just such that I could get a useful traceback. 
>
> Using the warnings and traceback modules, it is possible to display a 
> traceback with a warning message. This will of course make the output of 
> warnings a lot more verbose. The warning messages might also be more 
> easily confused with error messages. So I'm not convinced that we should 
> do this by default. 
>
> But we could certainly do this in the doctester (see #21191 for that). 
> This would already be quite useful, the disadvantages do not really seem 
> to apply in that case. The only issue is that warnings would look 
> different in interactive usage and in doctests. But this is already the 
> case for exception messages (IPython formats them in a different way). 
>
> What do you think? 
>
>
> Jeroen. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to