lsst.utils

The lsst.utils module provides common code for tests, interfacing between C++ and Python, and debugging.

Changes

Contributing

lsst.utils is developed at https://github.com/lsst/utils. You can find Jira issues for this module under the utils component.

Python API reference

lsst.utils Package

Functions

continueClass(cls) Re-open the decorated class, adding any new definitions into the original.
demangleType(type_name)

Deprecated since version v23.

deprecate_pybind11(obj, reason, version, …) Deprecate a pybind11-wrapped C++ interface function, method or class.
doImport(importable) Import a python object given an importable string and return it.
getPackageDir(package_name) Find the file system location of the EUPS package.
get_caller_name(skip) Get the name of the caller method.
inClass(cls[, name]) Add the decorated function to the given class as a method.
inheritDoc(klass) Extends existing documentation for a method that exists in another class and extend it with any additional documentation defined.
isEnabled() Check that backtrace is enabled.
suppress_deprecations(category) Suppress warnings generated by deprecated.sphinx.deprecated.

Classes

TemplateMeta A metaclass for abstract base classes that tie together wrapped C++ template types.

Class Inheritance Diagram

Inheritance diagram of lsst.utils.wrappers.TemplateMeta

lsst.utils.tests Module

Functions

init() Initialize the memory tester and file descriptor leak tester.
getTempFilePath(ext, expectOutput) Return a path suitable for a temporary file and try to delete the file on success
assertFloatsAlmostEqual(testCase, lhs, …) Highly-configurable floating point comparisons for scalars and arrays.
assertFloatsNotEqual(testCase, lhs, …) Fail a test if the given floating point values are equal to within the given tolerances.
assertFloatsEqual(testCase, lhs, …) Assert that lhs == rhs (both numeric types, whether scalar or array).
debugger(*exceptions) Decorator to enter the debugger when there’s an uncaught exception
classParameters(**settings) Class decorator for generating unit tests
methodParameters(**settings) Method decorator for unit tests

Classes

MemoryTestCase([methodName]) Check for resource leaks.
ExecutablesTestCase([methodName]) Test that executables can be run and return good status.
TestCase([methodName]) Subclass of unittest.TestCase that adds some custom assertions for convenience.

Class Inheritance Diagram

Inheritance diagram of lsst.utils.tests.MemoryTestCase, lsst.utils.tests.ExecutablesTestCase, lsst.utils.tests.TestCase