git.iko.soy/typeable/nixpkgs
on master help sign in
sage: fix transient ecl error (#54285)

Sometimes the doctests fail because ecl races to create a directory. This should fix that by making sure each process has its own directory.

commitd34f44db4508cdcce96382cb80bd11fbe9c7d614 authorTimo Kaufmann <timokau@zoho.com> dateFri 18 Jan 2019, 23:02 (8 years ago) parenta261175
2 files changed+22
pkgs/applications/science/math/sage/patches/fix-ecl-race.patch+19 pkgs/applications/science/math/sage/sage-src.nix+3
pkgs/applications/science/math/sage/patches/fix-ecl-race.patchnew file+19
@@ -0,0 +1,19 @@
1+diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py
2+index 02e18e67e7..2ebf6eb35f 100644
3+--- a/src/sage/doctest/forker.py
4++++ b/src/sage/doctest/forker.py
5+@@ -1075,6 +1075,14 @@ class SageDocTestRunner(doctest.DocTestRunner, object):
6+ sage: set(ex2.predecessors) == set([ex0,ex1])
7+ True
8+ """
9++
10++ # Fix ECL dir race conditions by using a separate dir for each process
11++ # (https://trac.sagemath.org/ticket/26968)
12++ os.environ['MAXIMA_USERDIR'] = "{}/sage-maxima-{}".format(
13++ tempfile.gettempdir(),
14++ os.getpid()
15++ )
16++
17+ if isinstance(globs, RecordingDict):
18+ globs.start()
19+ example.sequence_number = len(self.history)
pkgs/applications/science/math/sage/sage-src.nix+3
@@ -46,6 +46,9 @@ stdenv.mkDerivation rec {
4646 # tests) are also run. That is necessary to test dochtml individually. See
4747 # https://trac.sagemath.org/ticket/26110 for an upstream discussion.
4848 ./patches/Only-test-py2-py3-optional-tests-when-all-of-sage-is.patch
49+
50+ # Fixes a potential race condition which can lead to transient doctest failures.
51+ ./patches/fix-ecl-race.patch
4952 ];
5053
5154 # Patches needed because of package updates. We could just pin the versions of