Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[drake_cmake_external] Add test case to disable solver #370

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions drake_cmake_external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ ExternalProject_Add(drake
-DWITH_USER_EIGEN:BOOLEAN=ON
-DWITH_USER_FMT:BOOLEAN=ON
-DWITH_USER_SPDLOG:BOOLEAN=ON
-DWITH_CSDP:BOOLEAN=OFF
PREFIX "${DRAKE_PREFIX}"
BINARY_DIR "${PROJECT_BINARY_DIR}/drake"
BUILD_ALWAYS ON
Expand Down
10 changes: 10 additions & 0 deletions drake_cmake_external/drake_external_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,13 @@ set_tests_properties(import_all_test PROPERTIES
ENVIRONMENT "PYTHONPATH=${DRAKE_PYTHONPATH}"
)

add_test(NAME solver_disabled_test
COMMAND Python3::Interpreter -B -m unittest solver_disabled_test
)
set_tests_properties(solver_disabled_test PROPERTIES
ENVIRONMENT "PYTHONPATH=${DRAKE_PYTHONPATH}"
LABELS small
REQUIRED_FILES "${CMAKE_CURRENT_SOURCE_DIR}/solver_disabled_test.py"
TIMEOUT 60
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SPDX-License-Identifier: MIT-0

"""
Provides an example of disabling the open-source CSDP solver.
"""

import unittest

from pydrake.solvers import CsdpSolver

class TestCsdpSolver(unittest.TestCase):
def test_unavailable(self):
solver = CsdpSolver()
self.assertFalse(solver.available())

if __name__ == '__main__':
unittest.main()
Loading