class TestCase(unittest.TestCase): def setUp(self): self.directory = tempfile.mkdtemp() self.ctx = VagrantContext(self.directory) self.ctx.rewrite_vagrantfile(self.vagrantfile) def tearDown(self): self.ctx.destroy() shutil.rmtree(self.directory)