From 56f6527595ae8adfb06d04e153f5ad6ebe06ba8e Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Thu, 4 Jul 2019 11:55:22 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=B6?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=82=D0=B5=D1=81=D1=82=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BA=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 5 +++++ requirements.txt | 1 + tests/__init__.py | 0 tests/test_ap.py | 19 +++++++++++++++++++ 4 files changed, 25 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/test_ap.py 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']) +