Ejemplo n.º 1
0
def test_container_worker_increment_task():
    # Override sys.argv to mimic runtime call
    sys_argv_backup = list(sys.argv)
    sys_path_backup = list(sys.path)
    temp_file = tempfile.NamedTemporaryFile(delete=False).name
    sys.argv = [
        CONTAINER_WORKER,
        "test_container_worker",
        "increment",
        "false",
        "null",
        "1",
        "2",
        "4",
        "3",
        "null",
        "value",
        "null",
        "1",
        "9",
        "3",
        "#",
        "$return_0",
        "null",
        temp_file,
    ]
    current_path = os.path.dirname(os.path.abspath(__file__))
    sys.path.append(current_path)
    main()
    sys.argv = sys_argv_backup
    sys.path = sys_path_backup
    os.remove(temp_file)
Ejemplo n.º 2
0
def test_container_worker_simple_task():
    # Override sys.argv to mimic runtime call
    sys_argv_backup = list(sys.argv)
    sys_path_backup = list(sys.path)
    sys.argv = [
        CONTAINER_WORKER,
        "test_container_worker",
        "simple",
        "false",
        "null",
        "0",
        "0",
    ]
    current_path = os.path.dirname(os.path.abspath(__file__))
    sys.path.append(current_path)
    main()
    sys.argv = sys_argv_backup
    sys.path = sys_path_backup