Commit 598a8869 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[CMake] allow tests to be run before installation

parent 0629d81e
......@@ -10,6 +10,8 @@ SET(PROJECT_NAME example-robot-data)
SET(PROJECT_DESCRIPTION "Set of robot URDFs for benchmarking and developed examples.")
SET(PROJECT_URL https://gepgitlab.laas.fr/${PROJECT_NAMESPACE}/${PROJECT_NAME})
STRING(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME})
# Print initial message
MESSAGE("${PROJECT_DESCRIPTION}, version ${PROJECT_VERSION}")
MESSAGE("Copyright (C) 2018-2019 CNRS-LAAS")
......@@ -35,7 +37,7 @@ INSTALL(DIRECTORY icub_description DESTINATION share/${PROJECT_NAME})
INSTALL(DIRECTORY talos_data DESTINATION share/${PROJECT_NAME})
INSTALL(DIRECTORY tiago_description DESTINATION share/${PROJECT_NAME})
ADD_SUBDIRECTORY(python)
ADD_SUBDIRECTORY(${PY_NAME})
ADD_SUBDIRECTORY(unittest)
SETUP_PROJECT_FINALIZE()
......@@ -6,5 +6,5 @@ SET(${PROJECT_NAME}_PYTHON_FILES
FOREACH(python ${${PROJECT_NAME}_PYTHON_FILES})
PYTHON_BUILD(. ${python})
INSTALL(FILES ${python} DESTINATION ${PYTHON_SITELIB}/example_robot_data)
INSTALL(FILES ${python} DESTINATION ${PYTHON_SITELIB}/${PY_NAME})
ENDFOREACH(python ${${PROJECT_NAME}_PYTHON_FILES})
from os.path import exists, join
import sys
from os.path import dirname, exists, join
import numpy as np
import pinocchio
from pinocchio.robot_wrapper import RobotWrapper
......@@ -13,6 +13,10 @@ def getModelPath(subpath):
if exists(join(path, subpath.strip('/'))):
print("using %s as modelPath" % path)
return path
for path in (dirname(dirname(dirname(__file__))), dirname(dirname(__file__))):
if exists(join(path, subpath.strip('/'))):
print("using %s as modelPath" % path)
return path
raise IOError('%s not found' % (subpath))
......
......@@ -3,6 +3,5 @@ SET(${PROJECT_NAME}_PYTHON_TESTS
)
FOREACH(TEST ${${PROJECT_NAME}_PYTHON_TESTS})
ADD_PYTHON_UNIT_TEST("py-${TEST}" "unittest/test_${TEST}.py")
ADD_PYTHON_UNIT_TEST("py-${TEST}" "unittest/test_${TEST}.py" .)
ENDFOREACH(TEST ${${PROJECT_NAME}_PYTHON_TESTS})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment