def test_wrong_xml(tmpdir):
    from rstxml2db import main
    badxml = str(tmpdir / 'bad.xml')
    with open(badxml, 'w') as fh:
        fh.write("<bad_tag>")
    with pytest.raises(SystemExit):
        main(['-o', 'result.xml', badxml])
Example #2
0
def test_version_from_cli(capsys):
    """Checks if option --version creates a correct version"""
    from rstxml2db import main
    import pytest

    with pytest.raises(SystemExit):
        main(["--version"])
def test_filenotfound2():
    #
    from rstxml2db import main

    with pytest.raises(SystemExit):
        main(['-o', 'result.xml', 'file-does-not-exist.xml'])