Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
bbf8e15
tests/run-tests.py: Don't print info for tests that pass.
dpgeorge Oct 23, 2024
5f5b00e
tests/run-multitests.py: Suppress diff.
dpgeorge Oct 25, 2024
b0bb19a
tests/run-tests.py: Capture KeyboardInterrupt for nicer exit.
dpgeorge Oct 31, 2024
5716a66
tests/hwtest.py: Add a full, automatic test runner.
dpgeorge Oct 30, 2024
4d56d22
tests/hwtest.py: Make sure unittest is installed.
dpgeorge Apr 10, 2025
7932eff
tests/hwtest.py: Add command to build all natmods.
dpgeorge Apr 10, 2025
06f1170
tests/hwtest.py: Improve CLI options.
dpgeorge Apr 14, 2025
056695d
tests/hwtest.py: Just print returncode on subprocess fail.
dpgeorge Apr 28, 2025
1747440
tests/hwtest.py: Change args to selection then devices.
dpgeorge Apr 28, 2025
0e69998
tests/hwtest.py: Run hardware tests in native mode if selected.
dpgeorge Apr 29, 2025
c2faadb
tests/hwtest.py: Support targets without a filesystem.
dpgeorge Apr 29, 2025
da88829
tests/hwtest.py: Run hardware tests after native tests.
dpgeorge May 12, 2025
a7ca1f0
tests/hwtest.py: Increase sleep and fix list append bug.
dpgeorge May 13, 2025
92c731d
tests/hwtest.py: Add multi_wlan tests.
dpgeorge May 21, 2025
87cce3f
tests/hwtest.py: Use -j8 for building natmods.
dpgeorge Jul 7, 2025
f678771
tests/hwtest.py: Remove armv6 and armv7em.
dpgeorge Jul 22, 2025
f8860e2
tests/hwtest.py: Fix target check.
dpgeorge Jul 25, 2025
7880bd2
tests/hwtest.py: Skip Octoprobe infrastructure.
dpgeorge Jul 26, 2025
c5714bf
tests/hwtest.py: Allow selecting natmods to build.
dpgeorge Aug 2, 2025
b7c0cd7
tests/hwtest.py: Add argparse and support a reference board.
dpgeorge Aug 6, 2025
2fa522e
tests/hwtest.py: Support any number of return values from target_info.
dpgeorge Aug 15, 2025
c210496
tests/hwtest.py: Update to use --test-instance.
dpgeorge Oct 1, 2025
9e6f1a9
tests/hwtest.py: Use new serial_test.py.
dpgeorge Oct 2, 2025
67b7861
tests/hwtest.py: Update for new serial_test.py.
dpgeorge Dec 8, 2025
9d1a1de
tests/run-tests.py: Add option to not print list of skipped tests.
dpgeorge Apr 28, 2025
236a9c5
tests: Increase buffer to 249 bytes.
dpgeorge Apr 15, 2025
a314072
tests/run-tests.py: Decrease MP_STREAM_GET_BUFFER_SIZE to 32-7.
dpgeorge Aug 6, 2025
cd5fea2
tests/run-tests.py: Exit with code 2 on error.
dpgeorge Apr 29, 2025
4784861
tests/micropython/extreme_exc.py: Skip on ESP32 with PSRAM.
dpgeorge Apr 10, 2025
0c7e2a0
tests/multi_extmod: Update pins for I2CTarget test using octoprobe.
dpgeorge Aug 2, 2025
3b6e59e
tests: Improve test support for renesas-ra boards.
dpgeorge Aug 6, 2025
d21a123
tests/extmod_hardware/machine_i2c_target.py: Improve pyboard support.
dpgeorge Aug 6, 2025
84ad6d1
tests/extmod/machine_uart_tx.py: Add tunings for zephyr boards.
dpgeorge Sep 8, 2025
b0500f1
tests/target_wiring/UM_FEATHERS2.py: Add target_wiring.
dpgeorge Sep 8, 2025
5e11a92
tests/target_wiring/ZEPHYR_FRDM_K64F.py: Add target_wiring.
dpgeorge Sep 8, 2025
bb9b660
tests/run-multitests.py: Ignore DHCPS messages.
dpgeorge Dec 4, 2025
df2169d
tests/extmod/machine_uart_tx.py: Double amount of data sent.
dpgeorge Dec 5, 2025
9be364a
tests/multi_net/udp_data_multi.py: Reduce number of UDP groups.
dpgeorge Aug 5, 2025
39f7b68
tests/ports/stm32_hardware/dma_alignment.py: Convert to target_wiring.
dpgeorge Mar 22, 2026
d77264b
tests/extmod_hardware: Add Pin test.
dpgeorge Mar 22, 2026
99067df
tests//micropython/schedule_sleep.py: Fail on mimxrt, nrf, samd.
dpgeorge Mar 25, 2026
5085ea0
wip
dpgeorge Dec 4, 2025
9059b7f
wip
dpgeorge Apr 2, 2026
63531a4
tests/target_wiring: Add more boards.
dpgeorge Apr 2, 2026
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
2 changes: 1 addition & 1 deletion tests/extmod/machine_i2s_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

try:
from machine import Pin, I2S
except ImportError:
except (AttributeError, ImportError):
print("SKIP")
raise SystemExit

Expand Down
4 changes: 4 additions & 0 deletions tests/extmod/machine_spi_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
# Tune test parameters based on the target.
if "alif" in sys.platform:
MAX_DELTA_MS = 20
elif "renesas-ra" in sys.platform:
MAX_DELTA_MS = 15
elif "esp8266" in sys.platform:
MAX_DELTA_MS = 50 # port requires much looser timing requirements
elif "zephyr" in sys.platform:
MAX_DELTA_MS = 10


def get_real_baudrate(spi):
Expand Down
8 changes: 7 additions & 1 deletion tests/extmod/machine_uart_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,16 @@
elif "samd" in sys.platform:
timing_margin_us = 300
bit_margin = 1
elif "zephyr" in sys.platform:
bit_margin = 1
if "frdm_k64f" in sys.implementation._machine:
timing_margin_us = 1200
elif "nucleo_wb55rg" in sys.implementation._machine:
timing_margin_us = 400

# Test that write+flush takes the expected amount of time to execute.
for bits_per_s in (2400, 9600, 115200):
text = "Hello World"
text = "Hello World" * 2
uart = UART(*uart_loopback_args, baudrate=bits_per_s, **uart_loopback_kwargs)
time.sleep_ms(initial_delay_ms)

Expand Down
2 changes: 1 addition & 1 deletion tests/extmod_hardware/machine_can2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from machine import CAN

CAN(2, 125_000)
except (ImportError, ValueError):
except (AttributeError, ImportError, ValueError):
print("SKIP")
raise SystemExit

Expand Down
2 changes: 1 addition & 1 deletion tests/extmod_hardware/machine_can_timings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

try:
from machine import CAN
except ImportError:
except (AttributeError, ImportError):
print("SKIP")
raise SystemExit

Expand Down
6 changes: 5 additions & 1 deletion tests/extmod_hardware/machine_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

try:
from machine import Counter
except ImportError:
except (AttributeError, ImportError):
print("SKIP")
raise SystemExit

Expand All @@ -16,6 +16,10 @@
id = 0
out_pin = 4
in_pin = 5
if "ESP32S2" in sys.implementation._machine:
# FeatherS2
out_pin = 5
in_pin = 6
elif sys.platform == "mimxrt":
if "Teensy" in sys.implementation._machine:
id = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/extmod_hardware/machine_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

try:
from machine import Encoder
except ImportError:
except (AttributeError, ImportError):
print("SKIP")
raise SystemExit

Expand Down
40 changes: 33 additions & 7 deletions tests/extmod_hardware/machine_i2c_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

try:
from machine import Pin, SoftI2C, I2CTarget
except ImportError:
except (AttributeError, ImportError):
print("SKIP")
raise SystemExit

Expand All @@ -30,10 +30,10 @@
args_target = (1,)
elif sys.platform == "pyboard":
if sys.implementation._build == "NUCLEO_WB55":
args_controller = {"scl": "B8", "sda": "B9"}
args_target = (3,)
args_controller = {"scl": "D13", "sda": "D12"} # Arduino header D13/D12
args_target = (1,) # PB8/PB9, Arduino header D15/D14
else:
args_controller = {"scl": "X1", "sda": "X2"}
args_controller = {"scl": "X7", "sda": "X8"}
args_target = ("X",)
elif "zephyr-nucleo_wb55rg" in sys.implementation._machine:
# PB8=I2C1_SCL, PB9=I2C1_SDA (on Arduino header D15/D14)
Expand All @@ -52,16 +52,38 @@
elif sys.platform == "samd":
args_controller = {"scl": "D5", "sda": "D1"}
args_target = ()
else:
print("Please add support for this test on this platform.")
raise SystemExit


def config_pull_up():
Pin(args_controller["scl"], Pin.OPEN_DRAIN, Pin.PULL_UP)
Pin(args_controller["sda"], Pin.OPEN_DRAIN, Pin.PULL_UP)


def config_pull_up_disable():
pass


if hasattr(Pin, "board") and hasattr(Pin.board, "PULL_SCL"):

def config_pull_up():
Pin("PULL_SCL", Pin.OUT, value=1)
Pin("PULL_SDA", Pin.OUT, value=1)

def config_pull_up_disable():
Pin("PULL_SCL", Pin.ANALOG)
Pin("PULL_SDA", Pin.ANALOG)

try:
from target_wiring import i2c_args_controller as args_controller
from target_wiring import i2c_args_target as args_target
from target_wiring import i2c_kwargs_target as kwargs_target
except:
pass

if "args_controller" not in globals():
print("Please add support for this test on this platform.")
raise SystemExit

class TestMemory(unittest.TestCase):
@classmethod
def setUpClass(cls):
Expand All @@ -72,6 +94,7 @@ def setUpClass(cls):

@classmethod
def tearDownClass(cls):
config_pull_up_disable()
cls.i2c_target.deinit()

def test_scan(self):
Expand Down Expand Up @@ -145,6 +168,7 @@ def setUpClass(cls):

@classmethod
def tearDownClass(cls):
config_pull_up_disable()
cls.i2c_target.deinit()

@unittest.skipIf(sys.platform == "esp32", "scan doesn't trigger IRQ_END_WRITE")
Expand Down Expand Up @@ -192,6 +216,7 @@ def setUpClass(cls):

@classmethod
def tearDownClass(cls):
config_pull_up_disable()
cls.i2c_target.deinit()

def test_read(self):
Expand Down Expand Up @@ -241,6 +266,7 @@ def setUpClass(cls):

@classmethod
def tearDownClass(cls):
config_pull_up_disable()
cls.i2c_target.deinit()

def test_scan(self):
Expand Down
47 changes: 47 additions & 0 deletions tests/extmod_hardware/machine_pin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Test machine.Pin.
#
# IMPORTANT: This test requires hardware connections.

try:
from machine import Pin
except ImportError:
print("SKIP")
raise SystemExit

import unittest

try:
from target_wiring import pin_loopback_pins
except:
from target_wiring import pwm_loopback_pins as pin_loopback_pins


class TestBase:
@classmethod
def setUpClass(cls):
print("set up pins:", cls.pin_out, cls.pin_in)
cls.p0 = Pin(cls.pin_out)
cls.p1 = Pin(cls.pin_in)

def setUp(self):
self.p0.init(Pin.OUT)
self.p1.init(Pin.IN)

def test_connections(self):
print(self.pin_out, self.pin_in)
print(self.p0, self.p1)
self.p0(1)
self.assertEqual(1, self.p1())
self.p0(0)
self.assertEqual(0, self.p1())


# Generate test classes, one for each set of pins to test.
for pin_out, pin_in in pin_loopback_pins:
cls_name = "Test_{}_{}".format(pin_out, pin_in)
globals()[cls_name] = type(
cls_name, (TestBase, unittest.TestCase), {"pin_out": pin_out, "pin_in": pin_in}
)

if __name__ == "__main__":
unittest.main()
Loading
Loading