tests: fix special characters in parametrize with variables

This commit is contained in:
Fu Hanxi
2025-07-16 08:42:58 +02:00
parent d1a860bda5
commit d280d36405
2 changed files with 12 additions and 8 deletions

View File

@@ -13,9 +13,10 @@ from pytest_embedded_idf.utils import idf_parametrize
],
indirect=True,
)
@pytest.mark.parametrize('test_message', ['test123456789!@#%^&*'])
@idf_parametrize('target', ['esp32s3', 'esp32c3', 'esp32c6', 'esp32h2'], indirect=['target'])
def test_usj_vfs_select(dut: Dut, test_message: list) -> None:
def test_usj_vfs_select(dut: Dut) -> None:
test_message = 'test123456789!@#%^&*'
dut.expect_exact('Press ENTER to see the list of tests')
dut.write('"test select read, write and timeout"')
dut.expect_exact('select timed out', timeout=2)
@@ -32,9 +33,10 @@ def test_usj_vfs_select(dut: Dut, test_message: list) -> None:
],
indirect=True,
)
@pytest.mark.parametrize('test_message', ['!(@*#&(!*@&#((SDasdkjhad\nce'])
@idf_parametrize('target', ['esp32s3', 'esp32c3', 'esp32c6', 'esp32h2'], indirect=['target'])
def test_usj_vfs_read_return(dut: Dut, test_message: list) -> None:
def test_usj_vfs_read_return(dut: Dut) -> None:
test_message = '!(@*#&(!*@&#((SDasdkjhad\nce'
dut.expect_exact('Press ENTER to see the list of tests')
dut.write('"read does not return on new line character"')
dut.expect_exact('ready to receive', timeout=2)
@@ -50,9 +52,10 @@ def test_usj_vfs_read_return(dut: Dut, test_message: list) -> None:
],
indirect=True,
)
@pytest.mark.parametrize('test_message', ['testdata'])
@idf_parametrize('target', ['esp32s3', 'esp32c3', 'esp32c6', 'esp32h2'], indirect=['target'])
def test_usj_vfs_read_blocking(dut: Dut, test_message: list) -> None:
def test_usj_vfs_read_blocking(dut: Dut) -> None:
test_message = 'testdata'
dut.expect_exact('Press ENTER to see the list of tests')
dut.write('"blocking read returns with available data"')
dut.expect_exact('ready to receive', timeout=2)

View File

@@ -13,9 +13,10 @@ from pytest_embedded_idf.utils import idf_parametrize
],
indirect=True,
)
@pytest.mark.parametrize('test_message', ['test123456789!@#%^&*'])
@idf_parametrize('target', ['esp32s3'], indirect=['target'])
def test_usb_cdc_vfs_default(dut: Dut, test_message: str) -> None:
def test_usb_cdc_vfs_default(dut: Dut) -> None:
test_message = 'test123456789!@#%^&*'
# test run: test_usb_cdc_select
dut.expect_exact('test_usb_cdc_select', timeout=2)
dut.expect_exact('select timed out', timeout=2)