HardPy is a python library for creating a test bench for devices.
HardPy allows you to:
- Create test benches for devices using pytest;
- Use a browser to view, run, and stop tests;
- Store test results in the CouchDB database.
pip3 install hardpy
Find examples of using the HardPy in the examples
folder.
Launch CouchDB with Docker.
Create couchdb.ini
file:
[chttpd]
enable_cors=true
[cors]
origins = *
methods = GET, PUT, POST, HEAD, DELETE
credentials = true
headers = accept, authorization, content-type, origin, referer, x-csrf-token
Run the Docker container from folder with couchdb.ini file:
docker run --name couchdb -p 5984:5984 -e COUCHDB_USER=dev -e COUCHDB_PASSWORD=dev -v ./couchdb.ini:/opt/couchdb/etc/local.ini couchdb:3.3
Add simple test to tests
folder
# conftest.py
import pytest
import hardpy
def pytest_configure(config: pytest.Config):
config.pluginmanager.register(hardpy.HardpyPlugin())
# test_1.py
import pytest
def test_one():
assert True
Launch hardpy-panel
from tests folder or launch hardpy-panel tests
and open page http://localhost:8000/ in browser.
The last test report is stored in runstore database, document - current. You can view the CouchDB instance through Fauxton web interface: http://127.0.0.1:5984/_utils