File: test_kwarg_storage.py

package info (click to toggle)
python-parsl 2025.01.13%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,072 kB
  • sloc: python: 23,817; makefile: 349; sh: 276; ansic: 45
file content (33 lines) | stat: -rw-r--r-- 743 bytes parent folder | download
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"