Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport PR #2656 on branch v3.8.x (TST: Handle second warning in test_all_nan_uncert_subset) #2657

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
"""
import warnings
import pytest
from contextlib import nullcontext

import numpy as np
from numpy.testing import assert_allclose

from astropy.nddata import StdDevUncertainty
from astropy.utils.exceptions import AstropyUserWarning
from astropy.utils.introspection import minversion
import astropy.units as u

from glue.core.roi import CircularROI, XRangeROI
Expand All @@ -18,6 +20,8 @@
from jdaviz.configs.cubeviz.plugins.tests.test_parsers import ASTROPY_LT_5_3
from jdaviz.configs.default.plugins.model_fitting.initializers import MODELS

PYTEST_LT_8_0 = not minversion(pytest, "8.0.dev")


def test_default_model_labels(specviz_helper, spectrum1d):
specviz_helper.load_data(spectrum1d)
Expand Down Expand Up @@ -430,7 +434,13 @@
plugin = specviz_helper.plugins['Model Fitting']
plugin.create_model_component('Linear1D')

with pytest.warns(AstropyUserWarning, match='Model is linear in parameters'):
if PYTEST_LT_8_0:
ctx = nullcontext()
else:
ctx = pytest.warns(

Check warning on line 440 in jdaviz/configs/default/plugins/model_fitting/tests/test_plugin.py

View check run for this annotation

Codecov / codecov/patch

jdaviz/configs/default/plugins/model_fitting/tests/test_plugin.py#L440

Added line #L440 was not covered by tests
AstropyUserWarning, match="Non-Finite input data has been removed by the fitter")

with pytest.warns(AstropyUserWarning, match='Model is linear in parameters'), ctx:
plugin.calculate_fit()

# check that slope and intercept are fit correctly to just the first 2
Expand Down
Loading