def test_main_defaults(capsys): sys.argv = ["script", str(filesdir / Path("workflow.wdl"))] wa.main() captured = capsys.readouterr().out.splitlines(True) with (filesdir / Path("expected.md")).open("r") as expected_output: expected = expected_output.readlines()[:-1] assert captured == expected + [ "> Generated using WDL AID ({})\n".format(wa.__version__) ]
def test_main_template(capsys): sys.argv = [ "script", str(filesdir / Path("workflow.wdl")), "--template", str(filesdir / Path("test.template")) ] wa.main() captured = capsys.readouterr() with (filesdir / Path("test.template")).open("r") as expected_output: expected = expected_output.read() assert captured.out == expected
def test_main_output(tmpdir): output_file = tmpdir.join("output.md") sys.argv = [ "script", str(filesdir / Path("workflow.wdl")), "-o", output_file.strpath ] wa.main() with output_file.open() as out_file: result = out_file.readlines() with (filesdir / Path("expected.md")).open("r") as expected_output: expected = expected_output.readlines()[:-1] assert result == expected + [ "> Generated using WDL AID ({})\n".format(wa.__version__) ]
def test_main_fallback(capsys): sys.argv = [ "script", str(filesdir / Path("workflow.wdl")), "--fallback-description", "...", "--fallback-category", "advanced", "--fallback-description-to-object" ] wa.main() captured = capsys.readouterr().out.splitlines(True) with (filesdir / Path("expected_fallback.md")).open("r") as expected_output: expected = expected_output.readlines()[:-1] assert captured == expected + [ "> Generated using WDL AID ({})\n".format(wa.__version__) ]
def test_main_strict(): sys.argv = ["script", str(filesdir / Path("workflow.wdl")), "--strict"] with pytest.raises(ValueError): wa.main()