File: test_main.py

package info (click to toggle)
python-asdf 2.14.3-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,280 kB
  • sloc: python: 16,612; makefile: 124
file content (21 lines) | stat: -rw-r--r-- 415 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import pytest

from .. import main


def test_help():
    # Just a smoke test, really
    main.main_from_args(["help"])


def test_invalid_command():
    with pytest.raises(SystemExit) as e:
        main.main([])
    assert e.value.code == 2

    with pytest.raises(SystemExit) as e:
        main.main(["foo"])
    if isinstance(e.value, int):
        assert e.value == 2
    else:
        assert e.value.code == 2