Ticket #12415: 12415_rebase_58.patch

File 12415_rebase_58.patch, 17.1 KB (added by jdemeyer, 7 years ago)
  • doc/en/developer/coding_in_other.rst

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1362481396 -3600
    # Node ID 1ad634b7a56593f23e230c8352d4f82e65c4784e
    # Parent  f2c7739c4f5c72b3bab7833d1faaee3eaeaa4d9e
    Rebase to Sage 5.8 and final fixes
    
    diff --git a/doc/en/developer/coding_in_other.rst b/doc/en/developer/coding_in_other.rst
    a b  
    437437          0
    438438    [2]:
    439439       [1]:
    440           0    # 32-bit
     440          2    # 32-bit
    441441          -2   # 64-bit
    442442       [2]:
    443           0    # 32-bit
     443          2    # 32-bit
    444444          1    # 64-bit
    445445       [3]:
    446446          1
  • sage/combinat/free_module.py

    diff --git a/sage/combinat/free_module.py b/sage/combinat/free_module.py
    a b  
    10671067
    10681068        sage: F = CombinatorialFreeModule(QQ, ['a','b'], prefix='x')
    10691069        sage: original_print_options = F.print_options()
     1070        sage: sorted(original_print_options.items())
     1071         [('bracket', None), ('latex_bracket', False), ('latex_prefix', None), ('latex_scalar_mult', None), ('monomial_cmp', <built-in function cmp>), ('prefix', 'x'), ('scalar_mult', '*'), ('tensor_symbol', None)]
     1072
    10701073        sage: e = F.basis()
    10711074        sage: e['a'] - 3 * e['b']
    10721075        x['a'] - 3*x['b']
     
    10841087        sage: F.print_options(monomial_cmp = lambda x,y: -cmp(x,y))
    10851088        sage: e['a'] - 3 * e['b']
    10861089        -3 x{'b'} + x{'a'}
     1090        sage: F.print_options(**original_print_options) # reset print options
    10871091
    10881092        sage: F = CombinatorialFreeModule(QQ, [(1,2), (3,4)])
    10891093        sage: e = F.basis()
     
    11201124        sage: g = 2*G.monomial(3) +     G.monomial(4)
    11211125        sage: tensor([f, g])
    11221126        2*x[1] # y[3] + x[1] # y[4] + 4*x[2] # y[3] + 2*x[2] # y[4]
    1123 
    1124         sage: F.print_options(**original_print_options) # reset print options
    11251127    """
    11261128
    11271129    @staticmethod
  • sage/combinat/ncsf_qsym/tutorial.py

    diff --git a/sage/combinat/ncsf_qsym/tutorial.py b/sage/combinat/ncsf_qsym/tutorial.py
    a b  
    140140
    141141    sage: SymmetricFunctions(QQ).inject_shorthands()
    142142    doctest:1075: RuntimeWarning: redefining global value `e`
    143     doctest:1075: RuntimeWarning: redefining global value `m`
    144143    sage: m[2,1]
    145144    m[2, 1]
    146145    sage: M(m[2,1])
  • sage/doctest/control.py

    diff --git a/sage/doctest/control.py b/sage/doctest/control.py
    a b  
    146146                options.timeout = 0
    147147            elif options.valgrind or options.massif or options.cachegrind or options.omega:
    148148                # Non-interactive debuggers: 48 hours
    149                 options.timeout = os.getenv('SAGE_TIMEOUT_VALGRIND', 48 * 60 * 60)
     149                options.timeout = int(os.getenv('SAGE_TIMEOUT_VALGRIND', 48 * 60 * 60))
    150150            elif options.long:
    151                 options.timeout = os.getenv('SAGE_TIMEOUT_LONG', 30 * 60)
     151                options.timeout = int(os.getenv('SAGE_TIMEOUT_LONG', 30 * 60))
    152152            else:
    153                 options.timeout = os.getenv('SAGE_TIMEOUT', 5 * 60)
     153                options.timeout = int(os.getenv('SAGE_TIMEOUT', 5 * 60))
    154154        if options.nthreads == 0:
    155155            options.nthreads = int(os.getenv('SAGE_NUM_THREADS_PARALLEL',1))
    156156        if options.failed and not (args or options.new or options.sagenb):
     
    213213            sage: DC.load_stats(filename)
    214214            sage: DC.stats['sage.doctest.control']
    215215            {u'walltime': 1.0}
     216
     217        If the file doesn't exist, nothing happens. If there is an
     218        error, print a message. In any case, leave the stats alone::
     219
     220            sage: d = tmp_dir()
     221            sage: DC.load_stats(os.path.join(d))  # Cannot read a directory
     222            Error loading stats from ...
     223            sage: DC.load_stats(os.path.join(d, "no_such_file"))
     224            sage: DC.stats['sage.doctest.control']
     225            {u'walltime': 1.0}
    216226        """
     227        # Simply ignore non-existing files
     228        if not os.path.exists(filename):
     229            return
     230
    217231        try:
    218232            with open(filename) as stats_file:
    219233                self.stats.update(json.load(stats_file))
     
    615629        EXAMPLES::
    616630
    617631            sage: from sage.doctest.control import DocTestDefaults, DocTestController
    618             sage: DC = DocTestController(DocTestDefaults(), ["hello_world.py"])
     632            sage: DC = DocTestController(DocTestDefaults(timeout=123), ["hello_world.py"])
    619633            sage: print DC._assemble_cmd()
    620             python "$SAGE_LOCAL/bin/sage-runtests" --serial --timeout=300 hello_world.py
     634            python "$SAGE_LOCAL/bin/sage-runtests" --serial --timeout=123 hello_world.py
    621635        """
    622636        cmd = '''python "%s" --serial '''%(os.path.join("$SAGE_LOCAL","bin","sage-runtests"))
    623637        opt = dict_difference(self.options.__dict__, DocTestDefaults().__dict__)
     
    655669
    656670        ::
    657671
    658             sage: DD = DocTestDefaults(valgrind=True, optional="all")
     672            sage: DD = DocTestDefaults(valgrind=True, optional="all", timeout=172800)
    659673            sage: DC = DocTestController(DD, ["hello_world.py"])
    660674            sage: DC.run_val_gdb(testing=True)
    661675            exec valgrind --tool=memcheck --leak-resolution=high --leak-check=full --num-callers=25 --suppressions="$SAGE_LOCAL/lib/valgrind/sage.supp"  --log-file=".../valgrind/sage-memcheck.%p" python "$SAGE_LOCAL/bin/sage-runtests" --serial --timeout=172800 --optional=all hello_world.py
  • sage/doctest/forker.py

    diff --git a/sage/doctest/forker.py b/sage/doctest/forker.py
    a b  
    5656        sage: init_sage()
    5757        sage: sage.plot.plot.DOCTEST_MODE
    5858        True
     59
     60    Check that pexpect interfaces are invalidated, but still work::
     61
     62        sage: gap.eval("my_test_var := 42;")
     63        '42'
     64        sage: gap.eval("my_test_var;")
     65        '42'
     66        sage: init_sage()
     67        sage: gap('Group((1,2,3)(4,5), (3,4))')
     68        Group( [ (1,2,3)(4,5), (3,4) ] )
     69        sage: gap.eval("my_test_var;")
     70        Traceback (most recent call last):
     71        ...
     72        RuntimeError: Gap produced error output...
    5973    """
    6074    # Do this once before forking.
    6175    import sage.all_cmdline
     
    6478    import sage.misc.displayhook
    6579    sys.displayhook = sage.misc.displayhook.DisplayHook(sys.displayhook)
    6680
    67     # Workaround for https://github.com/sagemath/sagenb/pull/84
     81    # Workarounds for https://github.com/sagemath/sagenb/pull/84
    6882    import sagenb.notebook.misc
     83    import sagenb.notebook.sage_email
     84
     85    def fixed_default_email_address():
     86        import socket
     87        import getpass
     88        return getpass.getuser() + "@" + socket.gethostname()
     89
     90    sagenb.notebook.sage_email.default_email_address = fixed_default_email_address
     91
    6992
    7093def warning_function(file):
    7194    """
     
    163186            self.outfile = outfile
    164187        self.spoofing = False
    165188        self.real_stdin = os.fdopen(os.dup(sys.stdin.fileno()), "r")
    166         self.real_stdout = os.fdopen(os.dup(sys.stdout.fileno()), "w")
    167         self.real_stderr = os.fdopen(os.dup(sys.stderr.fileno()), "w")
     189        self.real_stdout = os.fdopen(os.dup(sys.stdout.fileno()), "a")
     190        self.real_stderr = os.fdopen(os.dup(sys.stderr.fileno()), "a")
    168191        self.position = 0
    169192
    170193    def __del__(self):
  • sage/doctest/sources.py

    diff --git a/sage/doctest/sources.py b/sage/doctest/sources.py
    a b  
    182182        for dt in new_doctests:
    183183            if len(dt.examples) > 0 and not (hasattr(dt.examples[-1],'sage_source')
    184184                                             and dt.examples[-1].sage_source == "sig_on_count()\n"):
    185                 sigon = doctest.Example("sig_on_count()\n", "0\n")
     185                # Line number refers to the end of the docstring
     186                sigon = doctest.Example("sig_on_count()\n", "0\n", lineno=docstring.count("\n"))
    186187                sigon.sage_source = "sig_on_count()\n"
    187188                dt.examples.append(sigon)
    188189            doctests.append(dt)
     
    659660            ....:             filename = os.path.join(path, F)
    660661            ....:             FDS = FileDocTestSource(filename, True, True, True, False)
    661662            ....:             FDS._test_enough_doctests(verbose=False)
     663            There are 18 tests in sage/combinat/partition.py that are not being run
     664            There are 12 tests in sage/combinat/tableau.py that are not being run
    662665            There are 3 unexpected tests being run in sage/doctest/parsing.py
    663666            There are 1 tests in sage/ext/c_lib.pyx that are not being run
    664667            There are 9 tests in sage/graphs/graph_plot.py that are not being run
  • sage/doctest/test.py

    diff --git a/sage/doctest/test.py b/sage/doctest/test.py
    a b  
    1818    Doctesting 1 file.
    1919    sage -t initial.rst
    2020    **********************************************************************
    21     File "initial.rst", line 3, in sage.doctest.tests.initial
     21    File "initial.rst", line 4, in sage.doctest.tests.initial
    2222    Failed example:
    23         a = binomiak(10,5)
     23        a = binomiak(10,5)  # random to test that we still get the exception
    2424    Exception raised:
    2525        Traceback (most recent call last):
    2626        ...
    2727        NameError: name 'binomiak' is not defined
    2828    **********************************************************************
    29     File "initial.rst", line 13, in sage.doctest.tests.initial
     29    File "initial.rst", line 14, in sage.doctest.tests.initial
    3030    Failed example:
    3131        binomial(10,5)
    3232    Expected:
     
    4141    ...
    4242    1
    4343
    44 Test a timeout::
     44Test a timeout using the ``SAGE_TIMEOUT`` environment variable::
    4545
    46     sage: subprocess.call(["sage", "-t", "-T", "3", "99seconds.rst"], cwd=tests_dir)  # long time
     46    sage: env = dict(os.environ)
     47    sage: env['SAGE_TIMEOUT'] = "3"
     48    sage: subprocess.call(["sage", "-t", "99seconds.rst"], cwd=tests_dir, env=env)  # long time
    4749    Running doctests...
    4850    Doctesting 1 file.
    4951    sage -t 99seconds.rst
  • sage/doctest/tests/initial.rst

    diff --git a/sage/doctest/tests/initial.rst b/sage/doctest/tests/initial.rst
    a b  
    1 One initial typo causes many failures::
     1One initial typo causes a ``NameError`` in the first test and many
     2following failures::
    23
    3     sage: a = binomiak(10,5)
     4    sage: a = binomiak(10,5)  # random to test that we still get the exception
    45    sage: a
    56    252
    67    sage: a == factorial(10)/factorial(5)^2
  • sage/ext/gen_interpreters.py

    diff --git a/sage/ext/gen_interpreters.py b/sage/ext/gen_interpreters.py
    a b  
    40994099    """
    41004100    module_mtime = os.stat(__file__).st_mtime
    41014101    try:
    4102         if os.stat(dir + '/timestamp').st_mtime > module_mtime:
     4102        if os.stat(os.path.join(dir, 'timestamp')).st_mtime >= module_mtime:
    41034103            # No need to rebuild.
    41044104            return
    41054105    except OSError:
  • sage/interfaces/gap.py

    diff --git a/sage/interfaces/gap.py b/sage/interfaces/gap.py
    a b  
    17821782        sage: import subprocess
    17831783        sage: from sage.interfaces.gap import gap_command
    17841784        sage: cmd = 'echo "quit;" | ' + gap_command(use_workspace_cache=False)[0]
    1785         sage: gap_startup = subprocess.check_output(cmd, shell=True)
     1785        sage: gap_startup = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
    17861786        sage: 'http://www.gap-system.org' in gap_startup
    17871787        True
    17881788        sage: 'Error' not in gap_startup
  • sage/interfaces/r.py

    diff --git a/sage/interfaces/r.py b/sage/interfaces/r.py
    a b  
    11661166
    11671167        ::
    11681168
    1169             sage: os.path.realpath(tmpdir) == sageobj(r.getwd())
     1169            sage: os.path.realpath(tmpdir) == sageobj(r.getwd())  # known bug (:trac:`9970`)
    11701170            True
    11711171        """
    11721172        self.execute('setwd(%r)' % dir)
  • sage/misc/hg.py

    diff --git a/sage/misc/hg.py b/sage/misc/hg.py
    a b  
    788788
    789789        EXAMPLES::
    790790
    791             sage: hg_sage.rename('sage/misc/hg.py', 'sage/misc/hgnew.py', options='--dry-run')
     791            sage: hg_sage.rename('sage/misc/hg.py', 'sage/misc/hgnew.py', options='--dry-run')  # random because locking might fail
    792792            Moving sage/misc/hg.py --> sage/misc/hgnew.py
    793793            cd ... && sage --hg mv --dry-run "sage/misc/hg.py" "sage/misc/hgnew.py"
    794794        """
     
    999999
    10001000        EXAMPLES::
    10011001
    1002             sage: hg_sage.revert('sage/misc/hg.py', rev=12000, options='--dry-run')
     1002            sage: hg_sage.revert('sage/misc/hg.py', rev=12000, options='--dry-run')  # random because locking might fail
    10031003            cd ... && sage --hg revert --dry-run -r 12000 sage/misc/hg.py
    10041004        """
    10051005        if not rev is None:
  • sage/plot/plot3d/tachyon.py

    diff --git a/sage/plot/plot3d/tachyon.py b/sage/plot/plot3d/tachyon.py
    a b  
    474474
    475475        -  ``phongtype`` - (default: "PLASTIC")
    476476
     477        EXAMPLES:
    477478
    478         EXAMPLES: We draw a scene with 4 sphere that illustrates various
    479         uses of the texture command::
     479        We draw a scene with 4 spheres that illustrates various uses of
     480        the texture command::
    480481
    481482            sage: t = Tachyon(camera_center=(2,5,4), look_at=(2,0,0), raydepth=6)
    482483            sage: t.light((10,3,4), 1, (1,1,1))
     
    487488            sage: t.sphere((0,-1,1), 1, 'mirror')
    488489            sage: t.sphere((2,-1,1), 0.5, 'mirror')
    489490            sage: t.sphere((2,1,1), 0.5, 'mirror')
    490             sage: show(t)
     491            sage: show(t)  # known bug (:trac:`7232`)
    491492        """
    492493        if texfunc and not isinstance(texfunc, Texfunc):
    493494            texfunc = self.texfunc(int(texfunc))
  • sage/rings/complex_interval_field.py

    diff --git a/sage/rings/complex_interval_field.py b/sage/rings/complex_interval_field.py
    a b  
    334334
    335335            sage: cmp(CIF, ComplexIntervalField(200))
    336336            -1
    337             sage: cmp(CIF, CC)
    338             1
     337            sage: cmp(CIF, CC) != 0
     338            True
    339339            sage: cmp(CIF, CIF)
    340340            0
    341341        """
  • sage/rings/finite_rings/element_base.pyx

    diff --git a/sage/rings/finite_rings/element_base.pyx b/sage/rings/finite_rings/element_base.pyx
    a b  
    602602
    603603        TESTS::
    604604
    605             sage: for p in [2,3,5,7,11]: # long
    606             ...       for n in [2,5,10]:
    607             ...           q = p^n
    608             ...           K.<a> = GF(q)
    609             ...           for r in (q-1).divisors():
    610             ...               if r == 1: continue
    611             ...               x = K.random_element()
    612             ...               y = x^r
    613             ...               if y.nth_root(r)**r != y: raise RuntimeError
    614             ...               if (y^41).nth_root(41*r)**(41*r) != y^41: raise RuntimeError
    615             ...               if (y^307).nth_root(307*r)**(307*r) != y^307: raise RuntimeError
    616 
     605            sage: for p in [2,3,5,7,11]:  # long time, random because of PARI warnings
     606            ....:     for n in [2,5,10]:
     607            ....:         q = p^n
     608            ....:         K.<a> = GF(q)
     609            ....:         for r in (q-1).divisors():
     610            ....:             if r == 1: continue
     611            ....:             x = K.random_element()
     612            ....:             y = x^r
     613            ....:             assert y.nth_root(r)^r == y
     614            ....:             assert (y^41).nth_root(41*r)^(41*r) == y^41
     615            ....:             assert (y^307).nth_root(307*r)^(307*r) == y^307
    617616            sage: k.<a> = GF(4)
    618617            sage: a.nth_root(0,all=True)
    619618            []
  • sage/rings/polynomial/multi_polynomial_ideal.py

    diff --git a/sage/rings/polynomial/multi_polynomial_ideal.py b/sage/rings/polynomial/multi_polynomial_ideal.py
    a b  
    36823682            [x^3 + y^2, x^2*y + 1]
    36833683
    36843684        A protocol is printed, if the verbosity level is at least 2,
    3685         or if the argument ``prot`` is provided. For some reason, the
    3686         protocol does not appear during doctests, so, we skip the
     3685        or if the argument ``prot`` is provided. Historically, the
     3686        protocol did not appear during doctests, so, we skip the
    36873687        examples with protocol output.  ::
    36883688
    36893689            sage: set_verbose(2)
    36903690            sage: I = R*[x^3+y^2,x^2*y+1]
    36913691            sage: I.groebner_basis()  # not tested
    36923692            std in (0),(x,y),(dp(2),C)
    3693             [4294967295:2]3ss4s6
     3693            [...:2]3ss4s6
    36943694            (S:2)--
    36953695            product criterion:1 chain criterion:0
    36963696            [x^3 + y^2, x^2*y + 1, y^3 - x]
    36973697            sage: I.groebner_basis(prot=False)
    36983698            std in (0),(x,y),(dp(2),C)
    3699             [4294967295:2]3ss4s6
     3699            [...:2]3ss4s6
    37003700            (S:2)--
    37013701            product criterion:1 chain criterion:0
    37023702            [x^3 + y^2, x^2*y + 1, y^3 - x]
    37033703            sage: set_verbose(0)
    37043704            sage: I.groebner_basis(prot=True)  # not tested
    37053705            std in (0),(x,y),(dp(2),C)
    3706             [4294967295:2]3ss4s6
     3706            [...:2]3ss4s6
    37073707            (S:2)--
    37083708            product criterion:1 chain criterion:0
    37093709            [x^3 + y^2, x^2*y + 1, y^3 - x]