Skip to content

Commit 2476317

Browse files
authored
Merge pull request #2606 from opensim-org/do_not_test_python_cma
Do not test CMA example.
2 parents 35ab0d5 + f164e72 commit 2476317

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

Bindings/Python/CMakeLists.txt

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,15 +270,26 @@ add_test(NAME python_tests
270270
--start-directory "${CMAKE_CURRENT_SOURCE_DIR}/tests"
271271
--verbose
272272
)
273+
274+
# List the examples we want to test. Some examples might run too long for
275+
# testing, or might require additional libraries.
276+
# Leave off the .py extension; here, we are listing module names.
277+
set(PYTHON_EXAMPLES_UNITTEST_ARGS
278+
build_simple_arm_model
279+
extend_OpenSim_Vec3_class
280+
posthoc_StatesTrajectory_example
281+
wiring_inputs_and_outputs_with_TableReporter
282+
)
273283
# Similar as above, but for the example files. These files aren't named as
274284
# test_*.py, so we must specify a more general search pattern.
275285
add_test(NAME python_examples
276286
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>"
277-
COMMAND "${PYTHON_EXECUTABLE}" -m unittest discover
278-
--start-directory "${CMAKE_CURRENT_SOURCE_DIR}/examples"
279-
--pattern *.py
287+
COMMAND "${PYTHON_EXECUTABLE}" -m unittest
288+
${PYTHON_EXAMPLES_UNITTEST_ARGS}
280289
--verbose
281290
)
291+
set_tests_properties(python_examples PROPERTIES
292+
ENVIRONMENT PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR}/examples)
282293

283294
if(WIN32)
284295
# On Windows, CMake cannot use RPATH to hard code the location of libraries
@@ -288,7 +299,7 @@ if(WIN32)
288299
# want to accidentally use a different OpenSim build/installation somewhere
289300
# on the machine.
290301
foreach(folder tests examples)
291-
set_tests_properties(python_${folder} PROPERTIES ENVIRONMENT
302+
set_property(TEST python_${folder} APPEND PROPERTY ENVIRONMENT
292303
"PATH=${CMAKE_BINARY_DIR}/$<CONFIG>")
293304
endforeach()
294305
endif()

Bindings/Python/examples/extend_OpenSim_Vec3_class.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ def myVec3Add(self,v):
4343
a = osim.Vec3(1,2,3)
4444
b = osim.Vec3(4,5,6)
4545
c = a+b
46-
print c
47-
print type(c)
46+
print(c)
47+
print(type(c))

0 commit comments

Comments
 (0)