Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions spin/cmds/meson.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,20 @@ def test(ctx, pytest_args, n_jobs, tests, verbose, coverage=False):
site_path = _set_pythonpath()

# Sanity check that library built properly
#
# We do this because `pytest` swallows exception messages originating from `conftest.py`.
# This can sometimes suppress useful information raised by the package on init.
if sys.version_info[:2] >= (3, 11):
p = _run([sys.executable, "-P", "-c", f"import {package}"], sys_exit=False)
if p.returncode != 0:
print(f"As a sanity check, we tried to import {package}.")
print("Stopping. Please investigate the build error.")
sys.exit(1)
else:
p = _run(
[sys.executable, "-c", f"import sys; del sys.path[0]; import {package}"],
sys_exit=False,
)
if p.returncode != 0:
print(f"As a sanity check, we tried to import {package}.")
print("Stopping. Please investigate the build error.")
sys.exit(1)

if (n_jobs != "1") and ("-n" not in pytest_args):
pytest_args = ("-n", str(n_jobs)) + pytest_args
Expand Down