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

Commit

Permalink
Trac #33213: don't clear SAGE_TMP upon exiting.
Browse files Browse the repository at this point in the history
  • Loading branch information
orlitzky committed Feb 17, 2022
1 parent 976d88b commit 8e09502
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions src/sage/misc/temporary_file.py
Expand Up @@ -26,38 +26,6 @@
import io
import os
import tempfile
import atexit


def delete_tmpfiles():
"""
Remove the directory ``SAGE_TMP``.
TESTS:
This is automatically run when Sage exits, test this by running a
separate session of Sage::
sage: from sage.tests.cmdline import test_executable
sage: child_SAGE_TMP, err, ret = test_executable(["sage", "-c", "print(SAGE_TMP)"])
sage: err, ret
('', 0)
sage: os.path.exists(child_SAGE_TMP) # indirect doctest
False
The parent directory should exist::
sage: parent_SAGE_TMP = os.path.normpath(child_SAGE_TMP + '/..')
sage: os.path.isdir(parent_SAGE_TMP)
True
"""
import shutil
from sage.misc.misc import SAGE_TMP
shutil.rmtree(str(SAGE_TMP), ignore_errors=True)


# Run when Python shuts down
atexit.register(delete_tmpfiles)


#################################################################
Expand Down

0 comments on commit 8e09502

Please sign in to comment.