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 spurious UnicodeWarning #14359

Closed
vbraun opened this issue Mar 26, 2013 · 16 comments
Closed

doctest spurious UnicodeWarning #14359

vbraun opened this issue Mar 26, 2013 · 16 comments

Comments

@vbraun
Copy link
Member

vbraun commented Mar 26, 2013

Doctests currently generate a spurious unicode warining:

[vbraun@localhost hg]$ sage -t sage/tests/french_book/polynomes.py
Running doctests with ID 2013-03-26-13-06-20-1ebc47c6.
Doctesting 1 file.
sage -t sage/tests/french_book/polynomes.py
/home/vbraun/opt/sage-5.9.beta1/local/lib/python2.7/site-packages/Cython/Build/Dependencies.py:229: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if code[q-1] == u'\\':
    [107 tests, 1.1 s]

Apply trac_14359_doctest_unicode_warning.patch

Depends on #12415
Depends on #14331
Depends on #13278

CC: @nexttime

Component: doctest framework

Author: Volker Braun

Reviewer: Jeroen Demeyer

Merged: sage-5.9.beta2

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

@vbraun vbraun added this to the sage-5.9 milestone Mar 26, 2013
@vbraun
Copy link
Member Author

vbraun commented Mar 26, 2013

Author: Volker Braun

@vbraun vbraun changed the title doctest suprious UnicodeWarning doctest spurious UnicodeWarning Mar 26, 2013
@roed314
Copy link
Contributor

roed314 commented Mar 26, 2013

comment:2

See also #14153.

@vbraun

This comment has been minimized.

@vbraun
Copy link
Member Author

vbraun commented Mar 26, 2013

comment:5

I think we should ignore ansi color sequences in doctests, I'm pretty sure this is the cause behind https://groups.google.com/d/msg/sage-release/9EyC1RhSg90/BooDydikYs8J though I don't know why they are not properly disabled in Hugh's setup.

@vbraun

This comment has been minimized.

@jdemeyer
Copy link

comment:7

Replying to @vbraun:

I think we should ignore ansi color sequences in doctests

Can we leave this for a different ticket until we really sure what the cause is?

Positive review to attachment: trac_14359_doctest_unicode_warning.patch

@vbraun
Copy link
Member Author

vbraun commented Mar 26, 2013

comment:8

Its definitely the cause for run_doctests not working on the Sage command line. Switch colors off (%color NoColor) and it works. I don't think it really matters what Hugh's problem is.

@roed314
Copy link
Contributor

roed314 commented Mar 26, 2013

comment:9

Replying to @vbraun:

Its definitely the cause for run_doctests not working on the Sage command line. Switch colors off (%color NoColor) and it works. I don't think it really matters what Hugh's problem is.

This is #14290.

@vbraun

This comment has been minimized.

@vbraun
Copy link
Member Author

vbraun commented Mar 26, 2013

Reviewer: Jeroen Demeyer

@jdemeyer
Copy link

Dependencies: #12415, #14331, #13278

@jdemeyer
Copy link

comment:12

Rebased.

@jdemeyer
Copy link

comment:13
sage -t --long devel/sage/sage/doctest/sources.py
**********************************************************************
File "devel/sage/sage/doctest/sources.py", line 664, in sage.doctest.sources.FileDocTestSource._test_enough_doctests
Failed example:
    for path, dirs, files in itertools.chain(os.walk('sage'), os.walk('doc')): # long time
        path = os.path.relpath(path)
        dirs.sort(); files.sort()
        for F in files:
            _, ext = os.path.splitext(F)
            if ext in ('.py', '.pyx', '.sage', '.spyx', '.rst'):
                filename = os.path.join(path, F)
                FDS = FileDocTestSource(filename, DocTestDefaults(long=True,optional=True))
                FDS._test_enough_doctests(verbose=False)
Expected:
    There are 18 tests in sage/combinat/partition.py that are not being run
    There are 12 tests in sage/combinat/tableau.py that are not being run
    There are 3 unexpected tests being run in sage/doctest/parsing.py
    There are 1 unexpected tests being run in sage/doctest/reporting.py
    There are 1 tests in sage/ext/c_lib.pyx that are not being run
    There are 9 tests in sage/graphs/graph_plot.py that are not being run
    There are 2 tests in sage/server/notebook/worksheet.py that are not being run
    doctest:229: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
Got:
    There are 18 tests in sage/combinat/partition.py that are not being run
    There are 12 tests in sage/combinat/tableau.py that are not being run
    There are 3 unexpected tests being run in sage/doctest/parsing.py
    There are 1 unexpected tests being run in sage/doctest/reporting.py
    There are 1 tests in sage/ext/c_lib.pyx that are not being run
    There are 9 tests in sage/graphs/graph_plot.py that are not being run
    There are 2 tests in sage/server/notebook/worksheet.py that are not being run
**********************************************************************

@jdemeyer
Copy link

Initial patch

@jdemeyer
Copy link

comment:14

Attachment: trac_14359_doctest_unicode_warning.patch.gz

@jdemeyer
Copy link

Merged: sage-5.9.beta2

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

3 participants