File: test_cli.py

package info (click to toggle)
daps 3.3.2%2Bcleaned1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,540 kB
  • sloc: xml: 9,773; sh: 3,059; python: 1,322; lisp: 380; makefile: 239
file content (51 lines) | stat: -rw-r--r-- 902 bytes parent folder | download | duplicates (3)
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__