1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
from pathlib import Path
import sys
import pytest
# "dxwf" is the abbreviated name for daps-xmlwellformed
# We can't import a name with a "-" so we use a link here:
import dxwf
ROOTDIR = Path(__file__).parent.parent
BINDIR = ROOTDIR / "bin"
PROG = [p for p in BINDIR.glob("daps*") if p.suffix != '.xsl'][0]
def test_help(capsys):
# given
# n/a
# when
with pytest.raises(SystemExit):
dxwf.main(["prog", "--help"])
# then
assert capsys.readouterr()
def test_invalid(capsys):
# given
# n/a
# when
with pytest.raises(SystemExit):
dxwf.main(["prog", "--asdf"])
# then
assert capsys.readouterr()
def test_version(capsys):
# given
# n/a
# when
with pytest.raises(SystemExit):
dxwf.main(["--version"])
captured = capsys.readouterr()
# then
assert captured.out.rsplit()[-1] == dxwf.__version__
|