File: test_cpp_components.py

package info (click to toggle)
dials 3.12.1%2Bdfsg3-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 19,068 kB
  • sloc: python: 119,028; cpp: 33,923; makefile: 158; sh: 144
file content (27 lines) | stat: -rw-r--r-- 733 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 procrunner
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 = procrunner.run([full_path])
    assert not result.returncode and not result.stderr