Skip to content

Catch warnings in tests #454

Description

@mkelley

Clean up the test output by catching (or avoiding) expected warnings, such as:

../../.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/data/phys.py:26
  /disks/data0/astro/Projects/sbpy/.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/data/phys.py:26: DeprecationWarning: Importing from 'astroquery.jplspec' is deprecated. Please use 'from astroquery.linelists.jplspec import JPLSpec' instead. The old import path will be removed in a future version.
    from astroquery.jplspec import JPLSpec

.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/activity/gas/tests/test_core.py::TestHaser::test_total_number_rho_AC75
  /disks/data0/astro/Projects/sbpy/.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/astropy/units/quantity.py:676: RuntimeWarning: divide by zero encountered in divide
    result = super().__array_ufunc__(function, method, *arrays, **kwargs)

.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/activity/gas/tests/test_data.py::TestOHFluorescenceSA88::test_linear_interpolation
.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/activity/tests/test_dust.py::test_phase_HalleyMarcus_linear_interp[0-1.0]
.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/activity/tests/test_dust.py::test_phase_HalleyMarcus_linear_interp[15-0.5872]
.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/activity/tests/test_dust.py::test_phase_HalleyMarcus_linear_interp[14.5-0.59605]
  /disks/data0/astro/Projects/sbpy/.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/utils/core.py:107: OptionalPackageUnavailable: `scipy`.
    warn(

.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/calib/core.py: 2 warnings
.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/calib/tests/test_core.py: 8 warnings
.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/calib/tests/test_sun.py: 1 warning
.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/units/tests/test_core.py: 8 warnings
docs/sbpy/activity/dust.rst: 2 warnings
docs/sbpy/calib.rst: 1 warning
docs/sbpy/units.rst: 4 warnings
  /disks/data0/astro/Projects/sbpy/.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/synphot/observation.py:113: AstropyUserWarning: Source spectrum is tapered.
    warnings.warn(msg, AstropyUserWarning)

.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/calib/tests/test_vega.py::TestVega::test_source_error
  /disks/data0/astro/Projects/sbpy/.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/utils/core.py:107: OptionalPackageUnavailable: `synphot`.
    warn(

.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/photometry/tests/test_iau.py::TestHG::test_evaluate
  /disks/data0/astro/Projects/sbpy/.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/photometry/iau.py:198: RuntimeWarning: divide by zero encountered in log10
    func = -2.5 * np.log10(func)

.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/photometry/tests/test_iau.py::TestHG1G2::test_g1g2_validator
  /disks/data0/astro/Projects/sbpy/.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/photometry/iau.py:334: UserWarning: G1, G2 combination results in an invalid phase function.
    warnings.warn('G1, G2 combination results in an invalid '

.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/photometry/tests/test_iau.py::TestHG1G2::test_g1g2_validator
  /disks/data0/astro/Projects/sbpy/.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/photometry/iau.py:326: UserWarning: G1, G2 combination results in an invalid phase function.
    warnings.warn('G1, G2 combination results in an invalid '

.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/units/core.py::sbpy.units.core.reflectance
.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/units/core.py::sbpy.units.core.reflectance
.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/units/core.py::sbpy.units.core.reflectance
.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/units/core.py::sbpy.units.core.reflectance
.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/units/core.py::sbpy.units.core.reflectance
.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/units/core.py::sbpy.units.core.reflectance
.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/units/core.py::sbpy.units.core.reflectance
.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/units/core.py::sbpy.units.core.reflectance
  /disks/data0/astro/Projects/sbpy/.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/units/core.py:165: SbpyWarning: 'W / (um m2)' (power density/spectral flux density wav) and 'W / (Hz m2)' (spectral flux density) are not convertible  Is "V(lambda pivot)" required and was it provided?
    warn(SbpyWarning(str(e)))

.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/units/core.py::sbpy.units.core.spectral_density_vega
.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/units/core.py::sbpy.units.core.spectral_density_vega
  /disks/data0/astro/Projects/sbpy/.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/units/core.py:165: SbpyWarning: 'Jy' (spectral flux density) and 'W / (um m2)' (power density/spectral flux density wav) are not convertible  Is "SDSS_r(lambda pivot)" required and was it provided?
    warn(SbpyWarning(str(e)))

.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/units/tests/test_core.py: 12 warnings
  /disks/data0/astro/Projects/sbpy/.tox/py312-test-alldeps-predeps/lib/python3.12/site-packages/sbpy/units/core.py:165: SbpyWarning: 'erg / (Angstrom s cm2)' (power density/spectral flux density wav) and 'W / (Hz m2)' (spectral flux density) are not convertible  Is "V(lambda pivot)" required and was it provided?
    warn(SbpyWarning(str(e)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions