pheon/tools/check_installed.py

26 lines
833 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 sys
from importlib.metadata import version
import pheon
from pheon._native import library
assert pheon.__version__ == version('pheon')
assert 'pyarrow' not in sys.modules
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)