File: test_cpp_components.py

package info (click to toggle)
dials 3.25.0%2Bdfsg3-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 20,112 kB
  • sloc: python: 134,740; cpp: 34,526; makefile: 160; sh: 142
file content (27 lines) | stat: -rw-r--r-- 754 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from __future__ import annotations

import os
import subprocess

import pytest

cpp_tests = [
    # Paths are under /build/
    "tests/algorithms/spatial_indexing/tst_collision_detection",
    "tests/algorithms/spot_prediction/tst_reeke_model",
]


@pytest.mark.parametrize(
    "executable", cpp_tests, ids=[p.replace("/", "-") for p in cpp_tests]
)
def test_cpp_program(executable):
    if "LIBTBX_BUILD" not in os.environ:
        pytest.skip("LIBTBX_ENV is unset; don't know how to find test executable")
    full_path = os.path.join(
        os.environ["LIBTBX_BUILD"], "dials", *(executable.split("/"))
    )
    print(full_path)

    result = subprocess.run([full_path], capture_output=True)
    assert not result.returncode and not result.stderr