From ebd3572943cf017152c18f5a439299c53e65eb54 Mon Sep 17 00:00:00 2001 From: Ricky O'Steen Date: Thu, 12 Sep 2024 16:48:45 -0400 Subject: [PATCH] Ignore UserWarning for Ubuntu tests --- .../default/plugins/model_fitting/tests/test_fitting.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/jdaviz/configs/default/plugins/model_fitting/tests/test_fitting.py b/jdaviz/configs/default/plugins/model_fitting/tests/test_fitting.py index 02d06f90c3..4878111503 100644 --- a/jdaviz/configs/default/plugins/model_fitting/tests/test_fitting.py +++ b/jdaviz/configs/default/plugins/model_fitting/tests/test_fitting.py @@ -7,6 +7,7 @@ from astropy.modeling import models from astropy.nddata import StdDevUncertainty from astropy.tests.helper import assert_quantity_allclose +from astropy.utils.exceptions import AstropyUserWarning from astropy.wcs import WCS from glue.core.roi import XRangeROI from numpy.testing import assert_allclose, assert_array_equal @@ -390,7 +391,8 @@ def test_cube_fit_with_nans(cubeviz_helper): mf = cubeviz_helper.plugins["Model Fitting"] mf.cube_fit = True mf.create_model_component("Const1D") - mf.calculate_fit() + with pytest.warns(AstropyUserWarning, match='Model is linear in parameters'): + mf.calculate_fit() result = cubeviz_helper.app.data_collection['model'] assert np.all(result.get_component("flux").data == 1) @@ -410,7 +412,8 @@ def test_cube_fit_with_subset_and_nans(cubeviz_helper): mf.cube_fit = True mf.spectral_subset = 'Subset 1' mf.create_model_component("Const1D") - mf.calculate_fit() + with pytest.warns(AstropyUserWarning, match='Model is linear in parameters'): + mf.calculate_fit() result = cubeviz_helper.app.data_collection['model'] print(cubeviz_helper.app.data_collection['model'].get_object(statistic=None).flux.max()) assert np.all(result.get_component("flux").data == 1)