The missing_ok argument was only added to pathlib.Path.unlink in Python 3.8.
This made the cleanup function fail (sometimes silently) on versions of Python
prior to 3.8.
import os
import shutil
import tempfile
+import shutil
import subprocess
import sys
import platform
TESTTYPES = {}
def cleanup():
- pathlib.Path(TMPFILE1).unlink(missing_ok=True)
- pathlib.Path(TMPFILE2).unlink(missing_ok=True)
- pathlib.Path(TMPINFILE).unlink(missing_ok=True)
+ shutil.rmtree(TMPFILE1, ignore_errors=True)
+ shutil.rmtree(TMPFILE2, ignore_errors=True)
+ shutil.rmtree(TMPINFILE, ignore_errors=True)
atexit.register(cleanup)
# Set REFDIR