Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doctest should test for warnings #3873

Closed
jasongrout opened this issue Aug 15, 2008 · 9 comments
Closed

Doctest should test for warnings #3873

jasongrout opened this issue Aug 15, 2008 · 9 comments

Comments

@jasongrout
Copy link
Member

This patch makes it so that warnings are output to stdout and are compared in the doctest framework. To doctest a warning, do something like:

def mytest():
    r"""
    EXAMPLES:
        sage: warnings.warn("hi")
        /...:1: UserWarning: hi
        #...
        """
    pass

This patch will probably break a few doctests (that gave warnings before, but the warnings were ignored).

Component: doctest coverage

Issue created by migration from https://trac.sagemath.org/ticket/3873

@mwhansen
Copy link
Contributor

comment:1

Attachment: doctest-warnings.patch.gz

@jasongrout
Copy link
Member Author

comment:2

This patch should be applied to whatever repository includes $SAGE_LOCAL/bin/

@jasongrout
Copy link
Member Author

comment:3

This depends on #3940 (which imports the warnings module on sage startup).

@sagetrac-cwitty
Copy link
Mannequin

sagetrac-cwitty mannequin commented Aug 24, 2008

Attachment: trac3873-sage_scripts.patch.gz

@sagetrac-cwitty
Copy link
Mannequin

sagetrac-cwitty mannequin commented Aug 24, 2008

Attachment: trac3873-doctest-warnings.patch.gz

@sagetrac-cwitty
Copy link
Mannequin

sagetrac-cwitty mannequin commented Aug 24, 2008

comment:4

Positive review for Jason's patch; my two patches need to be reviewed. The first patch (to be applied to sage_scripts after Jason's patch) fixes Jason's patch to not depend on #3940 any more, and to get rid of useless filenames (that would have to be elided from every doctest).

The second patch fixes the two places in the Sage library that generate warnings in doctests.

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Aug 25, 2008

comment:5

Nice patches, but how does #3940 relate here?

Cheers,

Michael

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Aug 25, 2008

comment:6

Positive review for Carl's patches.

Cheers,

Michael

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Aug 25, 2008

comment:7

Merged all three patches in Sage 3.1.2.alpha1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants