pheon/tools/check_installed.py

26 lines
829 B
Python
Raw Normal View History

"""Run outside the checkout, without PHEON_LIBRARY, after installing a wheel."""
from pathlib import Path
import subprocess
import sys
import unittest
ROOT = Path(__file__).resolve().parents[1]
# A separate interpreter verifies that base packing does not import PyArrow.
subprocess.run(
[sys.executable, "-I", "-c", """
import importlib.util
import sys
import pheon
from pheon._native import library
assert 'pyarrow' not in sys.modules
assert importlib.util.find_spec('klamath_rs_ext') is None
assert library.parent == __import__('pathlib').Path(pheon.__file__).parent
assert pheon.pack_int2([1, -2]) == bytes.fromhex('0001fffe')
"""],
check=True,
)
suite = unittest.defaultTestLoader.discover(str(ROOT / "tests/python"))
if not unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful():
raise SystemExit(1)