Ticket #6379 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

[with patch, positive review] #2513 made R.py doctest fail for non-english locale

Reported by: GeorgSWeber Owned by: GeorgSWeber
Priority: critical Milestone: sage-4.1.1
Component: interfaces Keywords:
Cc: Work issues:
Report Upstream: Reviewers: Minh Van Nguyen
Authors: Georg S. Weber Merged in: sage-4.1.1.alpha0
Dependencies: Stopgaps:

Description

In ticket #276, the LANG environment variable was set in sage-env (to en_US.UTF-8) and in ticket #2513, this was undone. On my box, the following doctest failure was a consequence:

sage -t -long "devel/sage/sage/interfaces/r.py"             
**********************************************************************
File "/Users/Shared/sage/sage-4.0.2/devel/sage/sage/interfaces/r.py", line 554:
    sage: r.library('foobar')
Expected:
    Traceback (most recent call last):
    ...
    ImportError: there is no package called 'foobar'
Got nothing
**********************************************************************
File "/Users/Shared/sage/sage-4.0.2/devel/sage/sage/interfaces/r.py", line 840:
    sage: r.completions('tes')
Expected:
    ['testPlatformEquivalence', 'testVirtual']
Got:
    ['testPlatformEquivalence', 'testPlatformEquivalence', 'testVirtual', 'testVirtual']
**********************************************************************
2 items had failures:
   1 of   5 in __main__.example_17
   1 of   3 in __main__.example_34
***Test Failed*** 2 failures.
For whitespace errors, see the file /Users/Shared/sage/sage-4.0.2/tmp/.doctest_r.py
         [6.3 s]

I have *none* of the usual "locale" variables set (LANG, LC_ALL, ...) but nevertheless R is clever enough to detect that I might want read its messages in german. (It's using some Mac OS feature, I think.) But unfortunately the Sage code did parse for english key-words in the R messages. Anyway, the above doctest failure could be triggered by anyone by issuing e.g. "export LANG=de_DE.UTF-8" just before running the doctest.

Attachments

trac_6379-Rdoctest.patch Download (1.2 KB) - added by GeorgSWeber 4 years ago.
tested against 4.0.2

Change History

comment:1 Changed 4 years ago by GeorgSWeber

  • Owner changed from was to GeorgSWeber
  • Status changed from new to assigned

Changed 4 years ago by GeorgSWeber

tested against 4.0.2

comment:2 Changed 4 years ago by GeorgSWeber

  • Summary changed from #2513 made R.py doctest fail for non-english locale to [with patch, needs review] #2513 made R.py doctest fail for non-english locale

comment:3 Changed 4 years ago by GeorgSWeber

  • Authors set to GeorgSWeber

comment:4 Changed 4 years ago by mvngu

  • Reviewers set to Minh Van Nguyen
  • Summary changed from [with patch, needs review] #2513 made R.py doctest fail for non-english locale to [with patch, positive review] #2513 made R.py doctest fail for non-english locale

All tests passed in Sage 4.1.

comment:5 Changed 4 years ago by mvngu

While testing out this patch, I came across an incidental problem. It's reported at this  sage-support thread. OK, so the patch fixes a locale problem. But then comes a problem with the R interface command r.library(). By the way, this has nothing to do with Georg's patch.

comment:6 Changed 4 years ago by mvngu

Just to let people know, this has been merged in sage-4.1.1-alpha0. I can't close this ticket because I don't have the privilege to do so. Sorry, folks :-(

comment:7 Changed 4 years ago by mvngu

  • Status changed from assigned to closed
  • Resolution set to fixed
  • Merged in set to sage-4.1.1.alpha0

comment:8 Changed 4 years ago by mvngu

  • Authors changed from GeorgSWeber to Georg S. Weber
Note: See TracTickets for help on using tickets.