botorch.test_utils

test_utils has its own directory with ‘botorch/’ to avoid circular dependencies: Anything in ‘tests/’ can depend on anything in ‘botorch/test_utils/’, and anything in ‘botorch/test_utils/’ can depend on anything in the rest of ‘botorch/’.

Mock

Utilities for speeding up optimization in tests.

botorch.test_utils.mock.mock_optimize_context_manager(force=False)[source]

A context manager that uses mocks to speed up optimization for testing. Currently, the primary tactic is to force the underlying scipy methods to stop after just one iteration.

force: If True will not raise an AssertionError if no mocks are called.

USE RESPONSIBLY.

Parameters:

force (bool)

Return type:

Generator[None, None, None]

botorch.test_utils.mock.mock_optimize(f)[source]

Wraps f in mock_optimize_context_manager for use as a decorator.

Parameters:

f (Callable)

Return type:

Callable