Skip to content

Commit 93a8422

Browse files
committed
feat(logging): Add logging to some tests to improve debugging
1 parent 64bf8df commit 93a8422

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

Diff for: tests/validation/gpio/test_gpio.py

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1+
import logging
2+
13
def test_gpio(dut):
4+
LOGGER = logging.getLogger(__name__)
5+
26
dut.expect_exact("Button test")
7+
8+
LOGGER.info("Expecting button press 1")
39
dut.expect_exact("Button pressed 1 times")
10+
11+
LOGGER.info("Expecting button press 2")
412
dut.expect_exact("Button pressed 2 times")
13+
14+
LOGGER.info("Expecting button press 3")
515
dut.expect_exact("Button pressed 3 times")

Diff for: tests/validation/nvs/test_nvs.py

+9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1+
import logging
2+
13
def test_nvs(dut):
4+
LOGGER = logging.getLogger(__name__)
5+
6+
LOGGER.info("Expecting counter value 0")
27
dut.expect_exact("Current counter value: 0")
8+
9+
LOGGER.info("Expecting counter value 1")
310
dut.expect_exact("Current counter value: 1")
11+
12+
LOGGER.info("Expecting counter value 2")
413
dut.expect_exact("Current counter value: 2")

Diff for: tests/validation/periman/test_periman.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import logging
2+
13
def test_periman(dut):
4+
LOGGER = logging.getLogger(__name__)
25
peripherals = [
36
"GPIO",
47
"SigmaDelta",
@@ -29,9 +32,10 @@ def test_periman(dut):
2932

3033
if peripheral in peripherals:
3134
if "not" in console_output:
32-
assert False, f"Peripheral {peripheral} printed when it should not"
35+
assert False, f"Output printed when it should not after peripheral {peripheral}"
36+
LOGGER.info(f"Correct output after peripheral: {peripheral}")
3337
peripherals.remove(peripheral)
3438
else:
3539
assert False, f"Unknown peripheral: {peripheral}"
3640

37-
assert peripherals == [], f"Missing peripherals output: {peripherals}"
41+
assert peripherals == [], f"Missing output after peripherals: {peripherals}"

Diff for: tests/validation/wifi/test_wifi.py

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1+
import logging
2+
13
def test_wifi(dut):
4+
LOGGER = logging.getLogger(__name__)
5+
6+
LOGGER.info("Starting WiFi Scan")
27
dut.expect_exact("Scan start")
38
dut.expect_exact("Scan done")
49
dut.expect_exact("Wokwi-GUEST")
10+
LOGGER.info("WiFi Scan done")
11+
12+
LOGGER.info("Connecting to WiFi")
513
dut.expect_exact("WiFi connected")
614
dut.expect_exact("IP address:")
15+
LOGGER.info("WiFi connected")

0 commit comments

Comments
 (0)