예제 #1
0
    def generate_file(tmp_dir, size, suffix='.tmp'):
        tmp = Tempfile(root_dir=tmp_dir, suffix=suffix)
        tmp.write(bytearray(random.randint(0, 255) for i in range(size)))

        tmp.close()

        return tmp
예제 #2
0
    def generate_file(tmp_dir, start, stop):
        tmp = Tempfile(folder=tmp_dir)
        tmp.write(bytearray(map(lambda v: v % 256, range(start, stop))))

        tmp.close()

        return tmp
예제 #3
0
def _generate_files(tmp_files, number, size):
    content = b'1' * size
    files = []
    for i in range(0, number):
        t = Tempfile()
        tmp_files.append(t)
        t.write(content)
        files.append(t)

    return files
예제 #4
0
def _generate_files(tmp_files, number, size):
    content = b'1' * size
    files = []
    for i in range(0, number):
        t = Tempfile()
        tmp_files.append(t)
        t.write(content)
        files.append(t)

    return files