mirror of
https://github.com/meshtastic/python.git
synced 2026-01-16 03:37:57 -05:00
initial pytest
This commit is contained in:
@@ -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
|
||||
```
|
||||
|
||||
30
meshtastic/tests/test_int.py
Normal file
30
meshtastic/tests/test_int.py
Normal 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
4
pytest.ini
Normal file
@@ -0,0 +1,4 @@
|
||||
[pytest]
|
||||
|
||||
markers =
|
||||
int: marks tests as integration
|
||||
Reference in New Issue
Block a user