Example #1
0
def test_version_from_cli(capsys):
    """Checks if option --version creates a correct version"""
    from rstxml2db.cli import main
    import pytest

    with pytest.raises(SystemExit):
        main(["--version"])
Example #2
0
def test_wrong_xml(tmpdir):
    from rstxml2db.cli import main
    badxml = str(tmpdir / 'bad.xml')
    with open(badxml, 'w') as fh:
        fh.write("<bad_tag>")

    result = main(['-o', 'result.xml', badxml])
    assert result != 0
Example #3
0
def test_filenotfound2():
    #
    from rstxml2db.cli import main

    result = main(['-o', 'result.xml', 'file-does-not-exist.xml'])
    assert result == ERROR_CODES[FileNotFoundError]