Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Trac #33213: ensure temporary gap workspace is created in a doctest.
Browse files Browse the repository at this point in the history
We have a GAP interface test that temporarily switches the workspace
location and creates an instance of Gap(), which is supposed to
(indirectly) reset the workspace. However, this doesn't necessarily
happen: there's a global variable called first_try that needs to be
True. Here we tweak the doctest to ensure that it is.
  • Loading branch information
orlitzky authored and dimpase committed Jun 13, 2022
1 parent 56e2964 commit 31986c1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/sage/interfaces/gap.py
Expand Up @@ -1474,9 +1474,12 @@ def gap_reset_workspace(max_workspace_size=None, verbose=False):
TESTS:
Check that the race condition from :trac:`14242` has been fixed.
We temporarily need to change the worksheet filename. ::
We temporarily need to change the worksheet filename, and to set
``first_try=True`` to ensure that the new workspace is created::
sage: ORIGINAL_WORKSPACE = sage.interfaces.gap.WORKSPACE
sage: saved_first_try = sage.interfaces.gap.first_try
sage: sage.interfaces.gap.first_try = True
sage: sage.interfaces.gap.WORKSPACE = tmp_filename()
sage: from multiprocessing import Process
sage: import time
Expand All @@ -1489,6 +1492,7 @@ def gap_reset_workspace(max_workspace_size=None, verbose=False):
....: p.join()
sage: os.unlink(sage.interfaces.gap.WORKSPACE) # long time
sage: sage.interfaces.gap.WORKSPACE = ORIGINAL_WORKSPACE
sage: sage.interfaces.gap.first_try = saved_first_try
"""
# Create new workspace with filename WORKSPACE
g = Gap(use_workspace_cache=False, max_workspace_size=None)
Expand Down

0 comments on commit 31986c1

Please sign in to comment.