From 28242677bb37b11d4fe5744df7fcd80ddd3d339d Mon Sep 17 00:00:00 2001 From: tligui_y Date: Tue, 12 Aug 2025 19:26:07 +0200 Subject: [PATCH] Update tests/test_utils_reprate.py --- tests/test_utils_reprate.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_utils_reprate.py b/tests/test_utils_reprate.py index 88398bc48..8d6b590e4 100644 --- a/tests/test_utils_reprate.py +++ b/tests/test_utils_reprate.py @@ -21,11 +21,12 @@ def test_get_beamline(instrument, expected_beamline): def test_get_pvname_reprate_for_inferred_beamline(): """Test the PV name retrieval when using inferred beamline based on IP address.""" - # Mock the socket to simulate an IP address with patch("socket.gethostname", return_value="testhost"), patch("socket.gethostbyname", return_value="129.129.242"): - beamline = infer_beamline() - pvname = get_pvname_reprate(instrument=None, beamline=beamline) - assert pvname == "alvra" + beamline = infer_beamline() # This will return "alvra" based on the IP + pvname = get_pvname_reprate(instrument=None, beamline=beamline) # This should return the PV name associated with 'aramis' + expected_pvname = "SIN-TIMAST-TMA:Bunch-1-Exp-Freq-RB" + assert pvname == expected_pvname, f"Expected {expected_pvname}, but got {pvname}" + @pytest.mark.parametrize("ip,expected_instrument", [ ("129.129.242", "alvra"),