add test program template for testing the PYTHON package

This commit is contained in:
Axel Kohlmeyer
2020-10-12 02:40:02 -04:00
parent c01ff34785
commit 6cda1e16ae
2 changed files with 101 additions and 0 deletions

View File

@ -1,3 +1,13 @@
# Test calling Python from LAMMPS (and importing the LAMMPS module
# inside those functions). This can do an "anonymous" import of symbols
# from the executable, so the shared library is not needed. The
# availability of the PYTHON package is tested for inside the tester.
add_executable(test_python_package test_python_package.cpp)
target_link_libraries(test_python_package PRIVATE lammps GTest::GMock GTest::GTest)
add_test(NAME PythonPackage COMMAND test_python_package WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_tests_properties(PythonPackage PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}:${LAMMPS_PYTHON_DIR}:$ENV{PYTHONPATH}")
# we must have shared libraries enabled for testing the python module
if(NOT BUILD_SHARED_LIBS)
message(STATUS "Skipping Tests for the LAMMPS Python Module: must enable BUILD_SHARED_LIBS")