def METHOD_NAME(self, size):
    with tempfile.NamedTemporaryFile(delete=False) as f:
        self.addCleanup(os.unlink, f.name)
        for _ in range(size):
            f.write(struct.pack('B', random.randrange(0, 1 << 8)))
        return f.name