Exemplo n.º 1
0
def test_simple_popen_python_script_with_kwargs():
    python_script = PopenPythonScript(
        COMPONENTS_SCRIPTS_FOLDER + "b.py",
        script_args="--arg_0=hello --arg_1=world",
    )
    run_work_isolated(python_script)
    assert python_script.has_succeeded
Exemplo n.º 2
0
def test_simple_python_script():
    python_script = PopenPythonScript(COMPONENTS_SCRIPTS_FOLDER + "a.py")
    run_work_isolated(python_script)
    assert python_script.has_succeeded

    python_script = TracerPythonScript(COMPONENTS_SCRIPTS_FOLDER + "a.py")
    run_work_isolated(python_script)
    assert python_script.has_succeeded
Exemplo n.º 3
0
def test_popen_python_script_failure():
    python_script = PopenPythonScript(
        COMPONENTS_SCRIPTS_FOLDER + "c.py",
        env={"VARIABLE": "1"},
        raise_exception=False,
    )
    run_work_isolated(python_script)
    assert python_script.has_failed
    assert python_script.status.message == "1"
Exemplo n.º 4
0
def test_non_existing_python_script():
    match = "tests/components/python/scripts/0.py"
    with pytest.raises(FileNotFoundError, match=match):
        python_script = PopenPythonScript(match)
        run_work_isolated(python_script)
        assert not python_script.has_started

    with pytest.raises(FileNotFoundError, match=match):
        python_script = TracerPythonScript(match)
        run_work_isolated(python_script)
        assert not python_script.has_started
Exemplo n.º 5
0
def test_tracer_python_script_with_kwargs():
    python_script = TracerPythonScript(
        COMPONENTS_SCRIPTS_FOLDER + "b.py",
        script_args="--arg_0=hello --arg_1=world",
        raise_exception=False,
    )
    run_work_isolated(python_script)
    assert python_script.has_succeeded

    python_script = TracerPythonScript(
        COMPONENTS_SCRIPTS_FOLDER + "c.py",
        env={"VARIABLE": "1"},
        raise_exception=False,
    )
    run_work_isolated(python_script)
    assert python_script.has_failed