@mark.parametrize('max_failure_rate', (0.5, 1.0))
def test_failure_rate(max_failure_rate: float, tmpdir: Path) -> None:
    cmd = [sys.executable, 'example/my_app.py', '-m', f'hydra.sweep.dir={tmpdir}', 'hydra.sweeper.optim.budget=2', 'hydra.sweeper.optim.num_workers=2', f'hydra.sweeper.optim.max_failure_rate={max_failure_rate}', 'error=true']
    (out, err) = run_process(cmd, print_error=False, raise_exception=False)
    assert ('Returning infinity for failed experiment' in out)
    error_string = 'RuntimeError: cfg.error is True'
    if (max_failure_rate < 1.0):
        assert (error_string in err)
    else:
        assert (error_string not in err)
@mark.parametrize('max_failure_rate', (0.5, 1.0))
def test_failure_rate(max_failure_rate: float, tmpdir: Path) -> None:
    cmd = [sys.executable, 'example/my_app.py', '-m', f'hydra.sweep.dir={tmpdir}', 'hydra.sweeper.optim.budget=2', 'hydra.sweeper.optim.num_workers=2', f'hydra.sweeper.optim.max_failure_rate={max_failure_rate}', 'error=true']
    (out, err) = run_process(cmd, print_error=False, raise_exception=False)
    assert ('Returning infinity for failed experiment' in out)
    error_string = 'RuntimeError: cfg.error is True'
    if (max_failure_rate < 1.0):
        assert (error_string in err)
    else:
        assert (error_string not in err)