def test_alias_read(self): from astropy.utils.data import conf with catch_warnings() as w: conf.reload() assert conf.remote_timeout == 42 assert len(w) == 1 assert str(w[0].message).startswith( "Config parameter 'name_resolve_timeout' in section " "[coordinates.name_resolve]")
def test_alias_read(self): from astropy.utils.data import conf with pytest.warns( AstropyDeprecationWarning, match=r"Config parameter 'name_resolve_timeout' in section " r"\[coordinates.name_resolve\].*") as w: conf.reload() assert conf.remote_timeout == 42 assert len(w) == 1
def test_alias_read(self): from astropy.utils.data import conf with catch_warnings() as w: conf.reload() assert conf.remote_timeout == 42 assert len(w) == 1 assert str(w[0].message) == ( "Config parameter 'name_resolve_timeout' in section " "[astropy.coordinates.name_resolve] is deprecated. Use " "'remote_timeout' in section [astropy.utils.data] instead.")
def test_warning_move_to_top_level(): # Check that the warning about deprecation config items in the # file works. See #2514 from ... import conf configuration._override_config_file = get_pkg_data_filename('data/deprecated.cfg') try: with catch_warnings(AstropyDeprecationWarning) as w: conf.reload() conf.max_lines assert len(w) == 1 finally: configuration._override_config_file = None conf.reload()
def teardown_class(self): from astropy.utils.data import conf configuration._override_config_file = None conf.reload()