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 (42 lines) | stat: -rw-r--r-- 681 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
import re
import pytest

# "gen" is the abbreviated name for "getentityname.py"
import gen


def test_help(capsys):
    # given
    # n/a

    # when
    with pytest.raises(SystemExit):
        gen.main(["prog", "--help"])

    # then
    assert capsys.readouterr()


def test_invalid(capsys):
    # given
    # n/a

    # when
    with pytest.raises(SystemExit):
        gen.main(["prog", "--asdf"])

    # then
    assert capsys.readouterr()


def test_version(capsys):
    # given
    # n/a

    # when
    with pytest.raises(SystemExit):
        gen.main(["prog", "--version"])
    captured = capsys.readouterr()

    # then
    assert captured.out.rstrip() == gen.__version__