diff --git a/README.md b/README.md index 58681db..d220cfc 100644 --- a/README.md +++ b/README.md @@ -156,10 +156,16 @@ If you need to build a new release you'll need: ``` apt install pandoc -sudo pip3 install markdown pdoc3 webencodings pyparsing twine autopep8 pylint +sudo pip3 install markdown pdoc3 webencodings pyparsing twine autopep8 pylint pytest ``` To lint, run: ``` pylint meshtastic ``` + +To test, first install this code locally, then run pytest: +``` +pip3 install . +pytest +``` diff --git a/meshtastic/tests/test_int.py b/meshtastic/tests/test_int.py new file mode 100644 index 0000000..ed359d4 --- /dev/null +++ b/meshtastic/tests/test_int.py @@ -0,0 +1,30 @@ +"""Meshtastic integration tests""" +import re +import subprocess +import platform + +import pytest + + +@pytest.mark.int +def test_int_no_args(): + """Test without any args""" + return_value, out = subprocess.getstatusoutput('meshtastic') + assert re.match(r'usage: meshtastic', out) + assert return_value == 1 + + +@pytest.mark.int +def test_int_version(): + """Test '--version'.""" + return_value, out = subprocess.getstatusoutput('meshtastic --version') + assert re.match(r'[0-9]+\.[0-9]+\.[0-9]', out) + assert return_value == 0 + + +@pytest.mark.int +def test_int_help(): + """Test '--help'.""" + return_value, out = subprocess.getstatusoutput('meshtastic --help') + assert re.match(r'usage: meshtastic ', out) + assert return_value == 0 diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..35e4231 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,4 @@ +[pytest] + +markers = + int: marks tests as integration