Beispiel #1
0
def __create_image(dot_graph, working_directory, image_name):
    image_path = join(working_directory, image_name)
    if not exists(image_path):
        makedirs(working_directory, exist_ok=True)
        dot_path = image_path + ".dot"
        safe_write(dot_graph, dot_path, append=False)
        Shell.exec("dot -Tpng -o""{}"" ""{}""".format(image_path, dot_path))
        remove(dot_path)
Beispiel #2
0
    def test_valid_by_md5_file(self):
        create_file(self.file)
        md5_file = join(self.tmp, "my.md5")
        safe_write(EMPTY_FILE_MD5, md5_file, append=False)

        validate_file(self.file, md5_file)
Beispiel #3
0
 def test_writes_file_safely(self):
     some_content = "Some content"
     safe_write(some_content, self.test_file, append=False)
     with open(self.test_file) as actual_file:
         assert actual_file.read() == some_content + '\n'