1# Need Python 3 string formatting functions
2from __future__ import print_function
3
4import ttfw_idf
5
6# TWAI Self Test Example constants
7STR_EXPECT = ('TWAI Alert and Recovery: Driver installed', 'TWAI Alert and Recovery: Driver uninstalled')
8EXPECT_TIMEOUT = 20
9
10
11@ttfw_idf.idf_example_test(env_tag='Example_TWAI1')
12def test_twai_alert_and_recovery_example(env, extra_data):
13    dut = env.get_dut('dut1', 'examples/peripherals/twai/twai_alert_and_recovery', dut_class=ttfw_idf.ESP32DUT)
14    dut.start_app()
15
16    for string in STR_EXPECT:
17        dut.expect(string, timeout=EXPECT_TIMEOUT)
18
19
20if __name__ == '__main__':
21    test_twai_alert_and_recovery_example()
22