COT.vm_context_manager
module¶
Context manager for virtual machine definitions.
-
class
VMContextManager
(input_file, output_file)[source]¶ Context manager for virtual machine definitions.
When the context manager exits, unless an error occurred, the virtual machine’s
write()
method is called. Regardless of whether an error occurred, the virtual machine’sdestroy()
method is then called.Use as follows:
with VMContextManager(input_file, output_file) as vm: vm.foo() vm.bar()