Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#14359 closed enhancement (fixed)

doctest spurious UnicodeWarning

Reported by: Volker Braun Owned by: Minh Van Nguyen
Priority: major Milestone: sage-5.9
Component: doctest framework Keywords:
Cc: Leif Leonhardy Merged in: sage-5.9.beta2
Authors: Volker Braun Reviewers: Jeroen Demeyer
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #12415, #14331, #13278 Stopgaps:

Status badges

Description (last modified by Volker Braun)

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

Attachments (1)

trac_14359_doctest_unicode_warning.patch (3.6 KB) - added by Jeroen Demeyer 10 years ago.
Initial patch

Download all attachments as: .zip

Change History (17)

comment:1 Changed 10 years ago by Volker Braun

Authors: Volker Braun
Summary: doctest suprious UnicodeWarningdoctest spurious UnicodeWarning

comment:2 Changed 10 years ago by David Roe

See also #14153.

comment:3 Changed 10 years ago by Leif Leonhardy

Cc: Leif Leonhardy added

comment:4 Changed 10 years ago by Volker Braun

Description: modified (diff)

comment:5 Changed 10 years ago by Volker Braun

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.

comment:6 Changed 10 years ago by Volker Braun

Description: modified (diff)
Status: newneeds_review

comment:7 in reply to:  5 Changed 10 years ago by Jeroen Demeyer

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 trac_14359_doctest_unicode_warning.patch

comment:8 Changed 10 years ago by Volker Braun

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.

comment:9 in reply to:  8 Changed 10 years ago by David Roe

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.

comment:10 Changed 10 years ago by Volker Braun

Description: modified (diff)
Reviewers: Jeroen Demeyer
Status: needs_reviewpositive_review

comment:11 Changed 10 years ago by Jeroen Demeyer

Dependencies: #12415, #14331, #13278

comment:12 Changed 10 years ago by Jeroen Demeyer

Rebased.

comment:13 Changed 10 years ago by Jeroen Demeyer

Status: positive_reviewneeds_work
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
**********************************************************************

Changed 10 years ago by Jeroen Demeyer

Initial patch

comment:14 Changed 10 years ago by Jeroen Demeyer

Status: needs_workpositive_review

comment:15 Changed 10 years ago by Jeroen Demeyer

Merged in: sage-5.9.beta2
Resolution: fixed
Status: positive_reviewclosed

comment:16 Changed 10 years ago by David Roe

Component: doctestdoctest framework
Note: See TracTickets for help on using tickets.