From 871358f59e96dfeb05ae2433c669f0647ecd640c Mon Sep 17 00:00:00 2001 From: Steven Murray Date: Tue, 9 Jul 2024 13:34:18 +0200 Subject: [PATCH] test: catch erfa warnings if emitted? --- hera_qm/tests/test_vis_metrics.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hera_qm/tests/test_vis_metrics.py b/hera_qm/tests/test_vis_metrics.py index 3e64ba05..3f36d9a1 100644 --- a/hera_qm/tests/test_vis_metrics.py +++ b/hera_qm/tests/test_vis_metrics.py @@ -10,13 +10,13 @@ import copy import pytest import warnings +from erfa.core import ErfaWarning pytestmark = pytest.mark.filterwarnings( "ignore:The uvw_array does not match the expected values given the antenna positions.", ) @pytest.fixture(scope='function') -@pytest.mark.filterwarnings("ignore:ERFA function") def vismetrics_data(): data = UVData() filename = os.path.join(DATA_PATH, 'zen.2457698.40355.xx.HH.uvcAA') @@ -26,10 +26,12 @@ def vismetrics_data(): data.select(antenna_nums=data.get_ants()[0:10]) data.select(freq_chans=range(100)) # Data file only has three times... need more. - while data.Ntimes < 90: - d2 = copy.deepcopy(data) - d2.time_array += d2.time_array.max() + d2.integration_time / (24 * 3600) - data += d2 + with warnings.catch_warnings(): + warnings.simplefilter("ignore", category=ErfaWarning) + while data.Ntimes < 90: + d2 = copy.deepcopy(data) + d2.time_array += d2.time_array.max() + d2.integration_time / (24 * 3600) + data += d2 ntimes = data.Ntimes nchan = data.Nfreqs data1 = qmtest.noise(size=(ntimes, nchan))