def METHOD_NAME(self, caplog):
    """Test the lifecyle of a resource and the use as a context manager."""
    with caplog.at_level(logging.DEBUG):
        self.instr = None
        gc.collect()
    assert "- closing" in caplog.records[0].message
    assert "- is closed", caplog.output[-1].message