Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#14359 closed enhancement (fixed)

doctest spurious UnicodeWarning

Reported by: vbraun Owned by: mvngu
Priority: major Milestone: sage-5.9
Component: doctest framework Keywords:
Cc: leif 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:

Description (last modified by vbraun)

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 jdemeyer 7 years ago.
Initial patch

Download all attachments as: .zip

Change History (17)

comment:1 Changed 7 years ago by vbraun

  • Authors set to Volker Braun
  • Summary changed from doctest suprious UnicodeWarning to doctest spurious UnicodeWarning

comment:2 Changed 7 years ago by roed

See also #14153.

comment:3 Changed 7 years ago by leif

  • Cc leif added

comment:4 Changed 7 years ago by vbraun

  • Description modified (diff)

comment:5 follow-up: Changed 7 years ago by vbraun

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 7 years ago by vbraun

  • Description modified (diff)
  • Status changed from new to needs_review

comment:7 in reply to: ↑ 5 Changed 7 years ago by jdemeyer

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 follow-up: Changed 7 years ago by 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.

comment:9 in reply to: ↑ 8 Changed 7 years ago by roed

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 7 years ago by vbraun

  • Description modified (diff)
  • Reviewers set to Jeroen Demeyer
  • Status changed from needs_review to positive_review

comment:11 Changed 7 years ago by jdemeyer

  • Dependencies set to #12415, #14331, #13278

comment:12 Changed 7 years ago by jdemeyer

Rebased.

comment:13 Changed 7 years ago by jdemeyer

  • Status changed from positive_review to needs_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 7 years ago by jdemeyer

Initial patch

comment:14 Changed 7 years ago by jdemeyer

  • Status changed from needs_work to positive_review

comment:15 Changed 7 years ago by jdemeyer

  • Merged in set to sage-5.9.beta2
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:16 Changed 7 years ago by roed

  • Component changed from doctest to doctest framework
Note: See TracTickets for help on using tickets.