def test_alloc(self, default, count, expected): with tempfile.NamedTemporaryFile() as f: f.write(default) f.flush() ret = hugepages._alloc(count, size=2048, path=f.name) f.seek(0) self.assertEqual(ret, expected)