File: test_main.py

package info (click to toggle)
python-asdf 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 7,032 kB
  • sloc: python: 24,068; makefile: 123
file content (21 lines) | stat: -rw-r--r-- 426 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import pytest

from asdf.commands 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