sageWithDoc: do not autodetect optional features when testing dochtml

main
Mauricio Collares 2 years ago
parent cecbb55fb0
commit 8ec9a32829
  1. 46
      pkgs/applications/science/math/sage/patches/Only-test-external-software-when-all-of-sage-is.patch
  2. 26
      pkgs/applications/science/math/sage/patches/Only-test-py2-py3-optional-tests-when-all-of-sage-is.patch
  3. 15
      pkgs/applications/science/math/sage/sage-src.nix
  4. 2
      pkgs/applications/science/math/sage/sagedoc.nix

@ -0,0 +1,46 @@
diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py
index 01f32fb8e4..4d83dc7b47 100644
--- a/src/sage/doctest/control.py
+++ b/src/sage/doctest/control.py
@@ -1253,6 +1253,7 @@ class DocTestController(SageObject):
self.log("Using --optional=" + self._optional_tags_string())
available_software._allow_external = self.options.optional is True or 'external' in self.options.optional
+ available_software._autodetect_safe = self.options.optional is True or 'sage' in self.options.optional
self.log("Features to be detected: " + ','.join(available_software.detectable()))
self.add_files()
self.expand_files_into_sources()
diff --git a/src/sage/doctest/external.py b/src/sage/doctest/external.py
index 84dae19ea5..badc61466e 100644
--- a/src/sage/doctest/external.py
+++ b/src/sage/doctest/external.py
@@ -409,6 +409,7 @@ class AvailableSoftware(object):
[]
"""
self._allow_external = True
+ self._autodetect_safe = True
# For multiprocessing of doctests, the data self._seen should be
# shared among subprocesses. Thus we use Array class from the
# multiprocessing module.
@@ -430,6 +431,8 @@ class AvailableSoftware(object):
sage: 'internet' in available_software # random, optional - internet
True
"""
+ if not self._autodetect_safe:
+ return False
try:
idx = self._indices[item]
except KeyError:
diff --git a/src/sage/features/sagemath.py b/src/sage/features/sagemath.py
index 433338766d..233623b14a 100644
--- a/src/sage/features/sagemath.py
+++ b/src/sage/features/sagemath.py
@@ -12,7 +12,7 @@ class sagemath_doc_html(StaticFile):
EXAMPLES::
- sage: from sage.features.sagemath import sagemath_doc_html
+ sage: from sage.features.sagemath import sagemath_doc_html # optional - sagemath_doc_html
sage: sagemath_doc_html().is_present() # optional - sagemath_doc_html
FeatureTestResult('sagemath_doc_html', True)
"""

@ -1,26 +0,0 @@
From f5ea42a7aaed7611fb55b65897b9fcf2b7bcf97e Mon Sep 17 00:00:00 2001
From: Timo Kaufmann <timokau@zoho.com>
Date: Sun, 21 Oct 2018 17:52:40 +0200
Subject: [PATCH] Only test py2/py3 optional tests when all of sage is tested
---
src/sage/doctest/control.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py
index 2d93841e50..6d156e29a1 100644
--- a/src/sage/doctest/control.py
+++ b/src/sage/doctest/control.py
@@ -375,7 +375,8 @@ class DocTestController(SageObject):
if not optionaltag_regex.search(o):
raise ValueError('invalid optional tag {!r}'.format(o))
- options.optional |= auto_optional_tags
+ if "sage" in options.optional:
+ options.optional |= auto_optional_tags
self.options = options
--
2.28.0

@ -70,11 +70,16 @@ stdenv.mkDerivation rec {
# Patches needed because of particularities of nix or the way this is packaged.
# The goal is to upstream all of them and get rid of this list.
nixPatches = [
# Make sure py2/py3 tests are only run when their expected context (all "sage"
# tests) are also run. That is necessary to test dochtml individually. See
# https://trac.sagemath.org/ticket/26110 for an upstream discussion.
# TODO: Determine if it is still necessary.
./patches/Only-test-py2-py3-optional-tests-when-all-of-sage-is.patch
# Since https://trac.sagemath.org/ticket/32174, some external features are
# marked as "safe" and get auto-detected, in which case the corresponding
# optional tests are executed. We disable auto-detection of safe features if
# we are doctesting with an "--optional" argument which does not include
# "sage", because tests from autodetected features expect context provided
# by running basic sage tests. This is necessary to test sagemath_doc_html
# separately. See https://trac.sagemath.org/ticket/26110 for a related
# upstream discussion (from the time when Sage still had optional py2/py3
# tags).
./patches/Only-test-external-software-when-all-of-sage-is.patch
# Fixes a potential race condition which can lead to transient doctest failures.
./patches/fix-ecl-race.patch

@ -83,6 +83,6 @@ stdenv.mkDerivation rec {
doCheck = true;
checkPhase = ''
${sage-with-env}/bin/sage -t --optional=dochtml --all
${sage-with-env}/bin/sage -t --optional=sagemath_doc_html --all
'';
}

Loading…
Cancel
Save