#9970: Flaky doctest in sage/interfaces/r.py
-----------------------------------------+--------------------------
       Reporter:  mpatel                 |        Owner:  mvngu
           Type:  defect                 |       Status:  needs_info
       Priority:  critical               |    Milestone:  sage-6.4
      Component:  doctest coverage       |   Resolution:
       Keywords:  r                      |    Merged in:
        Authors:  Willem Jan Palenstijn  |    Reviewers:
Report Upstream:  N/A                    |  Work issues:
         Branch:                         |       Commit:
   Dependencies:                         |     Stopgaps:
-----------------------------------------+--------------------------
Description changed by jdemeyer:

Old description:

> [http://groups.google.com/group/sage-
> release/browse_thread/thread/01a01378099b9d5e/3fe4b83c4c612663#3fe4b83c4c612663
> Dima Pasechnik reports on sage-release]:
> {{{
> Builds and tests OK on Linux amd64 (Debian unstable). Got one test
> failure:
>
> sage -t  "devel/sage/sage/interfaces/r.py"
> **********************************************************************
> File
> "/usr/local/src/sage/sage-4.6.alpha1/devel/sage/sage/interfaces/r.py",
> line 1128:
>     sage: tmpdir in sageobj(r.getwd())
> Expected:
>     True
> Got:
>     False
>
> that however would  not repeat if I tested again...
> }}}
>
> I've also seen this error, on occasion.  The test lines are
> {{{
> #!python
>             sage: import tempfile
>             sage: tmpdir = tempfile.mkdtemp()
>             sage: r.chdir(tmpdir)
>             sage: tmpdir in sageobj(r.getwd())
>             True
> }}}
> The script
> {{{
> #!python
> import os
> import tempfile
>
> fail = 0
> for i in xrange(1000):
>     tmpdir = tempfile.mkdtemp()
>     r.chdir(tmpdir)
>     if tmpdir not in sageobj(r.getwd()):
>         print tmpdir, r.getwd(), sageobj(r.getwd())
>         fail += 1
>     os.rmdir(tmpdir)  # clean up
>
> print fail
> }}}
> prints
> {{{
> #!python
> /tmp/tmpb1LEIM [1] "/tmp/tmpb1LEIM" /tmp/tmpbInteger(1)EIM
> /tmp/tmpZ6LyPm [1] "/tmp/tmpZ6LyPm" /tmp/tmpZInteger(6)yPm
> /tmp/tmp2LTCse [1] "/tmp/tmp2LTCse" /tmp/tmpInteger(2)TCse
> /tmp/tmpzoor1L [1] "/tmp/tmpzoor1L" /tmp/tmpzoorInteger(1)
> /tmp/tmpCl70Lo [1] "/tmp/tmpCl70Lo" /tmp/tmpClInteger(70)o
> /tmp/tmpN7L_vQ [1] "/tmp/tmpN7L_vQ" /tmp/tmpNInteger(7)_vQ
> /tmp/tmp9LAnw8 [1] "/tmp/tmp9LAnw8" /tmp/tmpInteger(9)Anw8
> /tmp/tmpvL13LQ [1] "/tmp/tmpvL13LQ" /tmp/tmpvLInteger(13)Q
> /tmp/tmpfB9L8g [1] "/tmp/tmpfB9L8g" /tmp/tmpfBInteger(9)8g
> /tmp/tmp0LtlQ6 [1] "/tmp/tmp0LtlQ6" /tmp/tmpInteger(0)tlQ6
> /tmp/tmpQF4L5I [1] "/tmp/tmpQF4L5I" /tmp/tmpQFInteger(4)5I
> /tmp/tmp_0LOOr [1] "/tmp/tmp_0LOOr" /tmp/tmp_Integer(0)OOr
> /tmp/tmpdDDj7L [1] "/tmp/tmpdDDj7L" /tmp/tmpdDDjInteger(7)
> /tmp/tmpr0LiLu [1] "/tmp/tmpr0LiLu" /tmp/tmprInteger(0)iLu
> /tmp/tmpu5LnMJ [1] "/tmp/tmpu5LnMJ" /tmp/tmpuInteger(5)nMJ
> /tmp/tmp0Py04L [1] "/tmp/tmp0Py04L" /tmp/tmp0PyInteger(04)
> /tmp/tmp3LZjCk [1] "/tmp/tmp3LZjCk" /tmp/tmpInteger(3)ZjCk
> 17
> }}}
> on sage.math.

New description:

 This test in `src/sage/interfaces/r.py` should be fixed:
 {{{
             sage: os.path.realpath(tmpdir) == sageobj(r.getwd())  # known
 bug (:trac:`9970`)
             True
 }}}

 The script
 {{{
 #!python
 import os
 import tempfile

 fail = 0
 for i in xrange(1000):
     tmpdir = tempfile.mkdtemp()
     r.chdir(tmpdir)
     if tmpdir not in sageobj(r.getwd()):
         print tmpdir, r.getwd(), sageobj(r.getwd())
         fail += 1
     os.rmdir(tmpdir)  # clean up

 print fail
 }}}
 prints
 {{{
 #!python
 /tmp/tmpb1LEIM [1] "/tmp/tmpb1LEIM" /tmp/tmpbInteger(1)EIM
 /tmp/tmpZ6LyPm [1] "/tmp/tmpZ6LyPm" /tmp/tmpZInteger(6)yPm
 /tmp/tmp2LTCse [1] "/tmp/tmp2LTCse" /tmp/tmpInteger(2)TCse
 /tmp/tmpzoor1L [1] "/tmp/tmpzoor1L" /tmp/tmpzoorInteger(1)
 /tmp/tmpCl70Lo [1] "/tmp/tmpCl70Lo" /tmp/tmpClInteger(70)o
 /tmp/tmpN7L_vQ [1] "/tmp/tmpN7L_vQ" /tmp/tmpNInteger(7)_vQ
 /tmp/tmp9LAnw8 [1] "/tmp/tmp9LAnw8" /tmp/tmpInteger(9)Anw8
 /tmp/tmpvL13LQ [1] "/tmp/tmpvL13LQ" /tmp/tmpvLInteger(13)Q
 /tmp/tmpfB9L8g [1] "/tmp/tmpfB9L8g" /tmp/tmpfBInteger(9)8g
 /tmp/tmp0LtlQ6 [1] "/tmp/tmp0LtlQ6" /tmp/tmpInteger(0)tlQ6
 /tmp/tmpQF4L5I [1] "/tmp/tmpQF4L5I" /tmp/tmpQFInteger(4)5I
 /tmp/tmp_0LOOr [1] "/tmp/tmp_0LOOr" /tmp/tmp_Integer(0)OOr
 /tmp/tmpdDDj7L [1] "/tmp/tmpdDDj7L" /tmp/tmpdDDjInteger(7)
 /tmp/tmpr0LiLu [1] "/tmp/tmpr0LiLu" /tmp/tmprInteger(0)iLu
 /tmp/tmpu5LnMJ [1] "/tmp/tmpu5LnMJ" /tmp/tmpuInteger(5)nMJ
 /tmp/tmp0Py04L [1] "/tmp/tmp0Py04L" /tmp/tmp0PyInteger(04)
 /tmp/tmp3LZjCk [1] "/tmp/tmp3LZjCk" /tmp/tmpInteger(3)ZjCk
 17
 }}}
 on sage.math.

--

--
Ticket URL: <http://trac.sagemath.org/ticket/9970#comment:32>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to