blob: c17e6de04e26456b7e4cca653b53a557d7a0d791 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
import atexit
import os
import shutil
import sys
import tempfile
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
import worldgen_path # noqa: E402,F401 (mapgen on sys.path)
if "WORLDMAP_TEST_TMP" not in os.environ:
_root = tempfile.mkdtemp(prefix="worldmap-viewer-tests-")
os.environ["WORLDMAP_TEST_TMP"] = os.environ["TMPDIR"] = tempfile.tempdir = _root
_pid = os.getpid()
atexit.register(lambda: os.getpid() == _pid and shutil.rmtree(_root, True))
|