diff --git a/Makefile b/Makefile index 9a80e74..e23ca40 100644 --- a/Makefile +++ b/Makefile @@ -13,3 +13,8 @@ html: pdf: make -C docs latexpdf +tests: + py.test-3 tests + +.PHONY: clean zip html pdf tests + diff --git a/requirements.txt b/requirements.txt index fe4bbde..f620c2c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ sphinx +pytest diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_ap.py b/tests/test_ap.py new file mode 100644 index 0000000..23e2258 --- /dev/null +++ b/tests/test_ap.py @@ -0,0 +1,19 @@ +import os +import sys +sys.path.insert(0, os.path.abspath('..')) + +import pytest +from py3x.functions import parse_args + +def test_parse_args_verbose(): + args = parse_args(['-v']) + assert args + +def test_parse_args_input(): + args = parse_args(['-i', 'input']) + assert args + +def test_parse_args_unused(): + with pytest.raises(SystemExit): + args = parse_args(['-b']) +