1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
import pytest
from parsl.app.app import bash_app
@bash_app
def foo(z=2, stdout=None):
return f"echo {z}"
@pytest.mark.shared_fs
def test_command_format_1(tmpd_cwd):
"""Testing command format for BashApps
"""
stdout = tmpd_cwd / "std.out"
for exp_value, z in (
("3", 3),
("4", 4),
("5", 5),
):
app_fu = foo(z=z, stdout=str(stdout))
assert app_fu.result() == 0, "BashApp had non-zero exit"
so_content = stdout.read_text().strip()
assert so_content == exp_value
stdout.unlink()
app_fu = foo(stdout=str(stdout))
assert app_fu.result() == 0, "BashApp had non-zero exit"
so_content = stdout.read_text().strip()
assert so_content == "2"
|