From b50447788cff9d5a63f7fb546108d37054a94cc7 Mon Sep 17 00:00:00 2001 From: Julianne Swinoga Date: Wed, 26 Oct 2022 11:09:58 -0400 Subject: [PATCH] Update happy path rx/tx fdm test to read and write data from the callback --- tests/test_fdm_connection.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/test_fdm_connection.py b/tests/test_fdm_connection.py index b74c80e..f678225 100644 --- a/tests/test_fdm_connection.py +++ b/tests/test_fdm_connection.py @@ -39,8 +39,12 @@ def mock_socket_bind(self, addr): @pytest.mark.parametrize('fdm_version', supported_fdm_versions) -def test_fdm_happypath(mocker, fdm_version): - rx_cb = lambda s, e_p: s +def test_fdm_rx_and_tx(mocker, fdm_version): + def rx_cb(fdm_data, event_pipe): + run_idx, = event_pipe.child_recv() + callback_version = fdm_data['version'] + event_pipe.child_send((run_idx, callback_version,)) + return fdm_data fdm_c = FDMConnection(fdm_version) @@ -49,6 +53,10 @@ def test_fdm_happypath(mocker, fdm_version): fdm_c.connect_rx('localhost', 55550, rx_cb) fdm_c.connect_tx('localhost', 55551) - for i in range(500): + for i in range(100): + fdm_c.event_pipe.parent_send((i,)) # manually call the process instead of having the process spawn fdm_c._fg_packet_roundtrip() + run_idx, callback_version = fdm_c.event_pipe.parent_recv() + assert run_idx == i + assert callback_version == fdm_version