Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ cmake-build-debug
### Arduino ###
.theia/
.arduino/
libraries/
tools

### Project-specific ###
.doxygen/theme
docs/

### vcsode ###
.vscode/

### python ###
tests/__pycache__/
1 change: 1 addition & 0 deletions tests/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
11 changes: 11 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Testing

## pre recs

uv: https://github.com/astral-sh/uv

## run tests

As tests run with user input they require a -s.

`uv run python3 -m pytest -s` or in a bash ternimal you can run `./runtest.sh`
1 change: 1 addition & 0 deletions tests/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("hello")
10 changes: 10 additions & 0 deletions tests/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[project]
name = "tests"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"pytest>=8.4.2",
"requests>=2.32.5",
]
1 change: 1 addition & 0 deletions tests/runtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uv run python3 -m pytest -s
25 changes: 25 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import requests
import json

ip = "192.168.0.105"

def test_get_health():
r = requests.get(f'http://{ip}/v1/device/status')
assert r.json()[0]["name"] == "Pathfinder"


def test_move_forward():
r = requests.post(f'http://{ip}/v1/movement-plan', data=json.dumps({
"name": "Movement Plan",
"persist": False,
"steps": [
{
"angle": 0,
"direction": "backward",
"distance": 1
}
]
}))
print(r.text)
move = input("Did it more backwards?")
assert move =="y"
247 changes: 247 additions & 0 deletions tests/uv.lock

Large diffs are not rendered by default.