# -*- python -*-
import os
import shutil
import subprocess

import SCons.Script
from lsst.sconsUtils import env, scripts, targets

scripts.BasicSConscript.tests(pyList=[], pySingles=["testSingle.py"])

if env.GetOption("clean"):
    dirName = os.path.join(SCons.Script.Dir("#").abspath, "tests", "testFailedTests")

    subprocess.call(
        f"""
            cd {dirName}
            scons -Qc > /dev/null 2>&1
        """,
        shell=True,
    )

    try:
        shutil.rmtree(os.path.join(dirName, "python"))
    except OSError:
        pass
