initial pytest

This commit is contained in:
Mike Kinney
2021-11-30 23:45:27 -08:00
parent 8fc7c2a0fe
commit ee8c124651
3 changed files with 41 additions and 1 deletions

View File

@@ -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
```

View File

@@ -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

4
pytest.ini Normal file
View File

@@ -0,0 +1,4 @@
[pytest]
markers =
int: marks tests as integration