bored-beard-89967
05/22/2024, 3:26 PMfrom flytekit import task
@task
def f(x: int) -> int:
    if x > 0:
        return x + 2
    else:
        raise ValueError("x must be positive")
    
def test_f_raises():
    with pytest.raises(ValueError):
        f(-1)
Will fail since flyte doesnβt seem to surface the ValueError, but instead shows a SystemExit. Any tips to bypass this type of behavior? I can easily abstract the logic out of f and test that python function independently from task f, but for more experimental workflows, we tend to avoid these decoupling abstractions.broad-monitor-993
05/22/2024, 3:30 PMf.task_functionbroad-monitor-993
05/22/2024, 3:31 PMbored-beard-89967
05/22/2024, 3:35 PMdef test_f_raises():
    with pytest.raises(ValueError):
        _f = f.task_function
        _f(-1)
works!bored-beard-89967
05/22/2024, 3:36 PM.task_function propertythankful-minister-83577
thankful-minister-83577
abundant-judge-84756
05/29/2024, 10:34 AMbroad-monitor-993
05/29/2024, 12:37 PMabundant-judge-84756
05/29/2024, 12:46 PMf, which previously passed using:
def test_f_raises():
    with pytest.raises(ValueError):
        f(-1)
Now in order to pass in 1.12.0 these have all been converted to:
def test_f_raises():
    with pytest.raises(ValueError):
        _f = f.task_function
        _f(-1)broad-monitor-993
05/29/2024, 4:09 PMabundant-judge-84756
05/30/2024, 1:21 PMhigh-accountant-32689
05/30/2024, 9:05 PMabundant-judge-84756
05/31/2024, 3:57 PM