File: pythonIntegrationTests.cmake

package info (click to toggle)
opm-simulators 2025.10%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,460 kB
  • sloc: cpp: 193,029; sh: 1,807; python: 1,704; lisp: 1,108; makefile: 31; awk: 10
file content (29 lines) | stat: -rw-r--r-- 981 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
28
29
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/tests/integration/HybridNewton)
execute_process(
  COMMAND "${Python3_EXECUTABLE}" -c "import tensorflow"
  RESULT_VARIABLE PYTHON_HAS_TENSORFLOW
  OUTPUT_QUIET
  ERROR_QUIET
)
if(PYTHON_HAS_TENSORFLOW EQUAL 0)
  add_test(NAME
            HybridNewton
           COMMAND
            ${Python3_EXECUTABLE}
            -m unittest discover
            ${PROJECT_SOURCE_DIR}/python/integration_tests/ml/hybrid_newton
          WORKING_DIRECTORY
            ${PROJECT_BINARY_DIR}/tests/integration/HybridNewton
    )
  if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.22)
    set(modifications
        "PYTHONPATH=path_list_append:${opm-common_DIR}/python"
        "PYTHONPATH=path_list_append:${CMAKE_CURRENT_BINARY_DIR}/python"
        "FLOW_BINARY=set:$<TARGET_FILE:flow>"
    )
    set_tests_properties(HybridNewton PROPERTIES
                         ENVIRONMENT_MODIFICATION
                           "${modifications}"
    )
  endif()
endif()