dodil/erp-platform

tests/test_template.py

"""The starter brick must keep working against THIS platform — its tests run as part of ours.

A template nobody runs rots quietly: the first person to copy it finds out. So every platform
change runs the template's own suite, in a separate process, from its own directory.
"""
import pathlib
import subprocess
import sys

TEMPLATE = pathlib.Path(__file__).resolve().parents[1] / "templates" / "brick-example"


def test_the_starter_brick_passes_its_own_tests():
    r = subprocess.run([sys.executable, "-m", "pytest", "-q", "--tb=short", "-p", "no:cacheprovider",
                        "-W", "ignore::DeprecationWarning", "--rootdir", ".", "-c", "pyproject.toml"],
                       cwd=TEMPLATE, capture_output=True, text=True, timeout=300)
    assert r.returncode == 0, r.stdout[-3000:] + r.stderr[-2000:]