#!/usr/bin/env python3 """Acceptance for the CRM task: the REST checks of crm_acceptance.py (21 checks) run on a COPY of the workspace. accept.py WORKSPACE exit 0 = every check passed """ import os import shutil import subprocess import sys import tempfile ws = os.path.abspath(sys.argv[1]) here = os.path.dirname(os.path.abspath(__file__)) check = os.path.join(here, "hidden", "crm_acceptance.py") tmp = tempfile.mkdtemp(prefix="crm-ws-") try: copy = os.path.join(tmp, "ws") shutil.copytree(ws, copy, ignore=shutil.ignore_patterns("__pycache__", "*.pyc", "*.db")) rc = subprocess.call([sys.executable, check, copy], timeout=600) finally: shutil.rmtree(tmp, ignore_errors=True) sys.exit(rc)