INNER CODE UNIT · Python
__init__
usnistgov/OSCAL · src/specifications/profile-resolution/spec-tester.py:103
def __init__(self, command: str, workdir: Optional[str] = None,
logger: Optional[logging.Logger] = None) -> None:
"""
Note: Creates a temporary directory as a side effect, consumer must call .cleanup() to remove
"""
if not DRIVER_SOURCE_TOKEN in command:
raise Exception(
f"Command `{command}` does not contain source token '{DRIVER_SOURCE_TOKEN}'")
if not DRIVER_DESTINATION_TOKEN in command:
raise Exception(
f"Command `{command}` does not contain source token '{DRIVER_DESTINATION_TOKEN}'")
self.logger = logger if logger is not None else logging.getLogger(
__name__)
self.command = command
self.workdir = workdir
self.out_directory = tempfile.mkdtemp("oscal-pr-test-out")