def setUp(self):
        if os.path.isdir(get_test_output_dir()):
            shutil.rmtree(get_test_output_dir())
        os.mkdir(get_test_output_dir())

        if os.path.exists(get_shell_calls_file()):
            os.remove(get_shell_calls_file())

        self.runner = PreprocessorRunner()
        self.runner.set_preprocessor_config(
            {"plantuml-cmd": "python shell_command.py"})
 def __get_shell_command_calls(self):
     assert os.path.exists(get_shell_calls_file())
     return json.load(open(get_shell_calls_file(), "rt"))
Пример #3
0
import sys
import os
import json
import file_locations

if __name__ == "__main__":
    # Generate the dummy image
    filename, _ = os.path.splitext(sys.argv[-1])
    if "-tsvg" in sys.argv:
        filename += ".svg"
    else:
        filename += ".png"

    open(filename, "w").write(" ".join(sys.argv))

    open(filename, "w").write(" ".join(sys.argv))

    #Append command output to calls file
    try:
        prev_commands = json.load(open(file_locations.get_shell_calls_file()))
    except IOError:
        prev_commands=[]

    prev_commands.append({
        "arguments": sys.argv[1:],
        "plantuml-code": open(sys.argv[-1], "rt").read().strip()
    })
    json.dump(prev_commands, open(file_locations.get_shell_calls_file(), "wt"), indent=2)