Skip to content

Commit 94344b4

Browse files
committed
[SD] Add Pytest file, rename to scenario yaml
1 parent 9c040ac commit 94344b4

File tree

7 files changed

+78
-2
lines changed

7 files changed

+78
-2
lines changed

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,15 @@ html/*
3939
# VSCode artifacts
4040
.vscode/*
4141
src/.vscode/settings.json
42-
4342
.DS_STORE
44-
4543
examples/Wippersnapper_demo/build/
4644

45+
# Virtual environment directories
4746
.venv/
47+
venv/
48+
49+
# Python artifacts
50+
tests/__pycache__/
4851

4952
# Platformio artifacts
5053
.pio/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/tests/test_netfsm_establish_wifi.scenario.yaml renamed to tests/scenarios/test_netfsm_establish_wifi.scenario.yaml

File renamed without changes.

tests/test_offline.py

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import pytest
2+
import subprocess
3+
4+
5+
def test_invalid_json():
6+
# Run the Wokwi CLI
7+
result = subprocess.run(
8+
[
9+
"wokwi-cli",
10+
"--elf",
11+
f"../.pio/build/esp32dev/firmware.elf",
12+
"--timeout",
13+
"120000",
14+
"--scenario",
15+
f"scenarios/offline/test-invalid-json.scenario.yaml",
16+
"--diagram-file",
17+
f"diagram.json",
18+
]
19+
)
20+
assert result.returncode == 0
21+
22+
23+
def test_analog_input():
24+
# Run the Wokwi CLI
25+
result = subprocess.run(
26+
[
27+
"wokwi-cli",
28+
"--elf",
29+
f"../.pio/build/esp32dev/firmware.elf",
30+
"--timeout",
31+
"120000",
32+
"--scenario",
33+
f"scenarios/offline/test-log-analogin.scenario.yaml",
34+
"--diagram-file",
35+
f"diagram.json",
36+
]
37+
)
38+
assert result.returncode == 0
39+
40+
41+
def test_digital_input():
42+
# Run the Wokwi CLI
43+
result = subprocess.run(
44+
[
45+
"wokwi-cli",
46+
"--elf",
47+
f"../.pio/build/esp32dev/firmware.elf",
48+
"--timeout",
49+
"120000",
50+
"--scenario",
51+
f"scenarios/offline/test-log-digital-in.scenario.yaml",
52+
"--diagram-file",
53+
f"diagram.json",
54+
]
55+
)
56+
assert result.returncode == 0
57+
58+
def test_ds18b20():
59+
# Run the Wokwi CLI
60+
result = subprocess.run(
61+
[
62+
"wokwi-cli",
63+
"--elf",
64+
f"../.pio/build/esp32dev/firmware.elf",
65+
"--timeout",
66+
"120000",
67+
"--scenario",
68+
f"scenarios/offline/test-log-ds18b20.scenario.yaml",
69+
"--diagram-file",
70+
f"diagram.json",
71+
]
72+
)
73+
assert result.returncode == 0

0 commit comments

Comments
 (0)