Skip to content

Commit

Permalink
TST: Pick up astropy-dev from index URL to get latest dev wheel (#2358)
Browse files Browse the repository at this point in the history
* TST: Pick up astropy-dev from index URL
to get latest dev wheel

* TST: Use legacy print option
for numpy 2.0.dev

* MNT: Compat with dev glue-jupyter

TST: Ignore pandas deprecation warning when using numpy-dev

* TST: pandas throwing error
not warning
  • Loading branch information
pllim authored Aug 11, 2023
1 parent 87c6bd9 commit 4bcc1b1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
6 changes: 3 additions & 3 deletions jdaviz/configs/imviz/tests/test_astrowidgets_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def test_mvp_markers(self):
self.viewer.add_markers(tbl)
data = self.imviz.app.data_collection[2]
assert data.label == 'default-marker-name'
assert data.style.color == '#ff0000' # Converted to hex now but still red
assert data.style.color in ('red', '#ff0000')
assert data.style.marker == 'o'
assert_allclose(data.style.markersize, 5)
assert_allclose(data.style.alpha, 1)
Expand All @@ -307,7 +307,7 @@ def test_mvp_markers(self):
self.viewer.add_markers(tbl, use_skycoord=True, marker_name='my_sky')
data = self.imviz.app.data_collection[3]
assert data.label == 'my_sky'
assert data.style.color == '#00ff00' # Converted to hex now but still green
assert data.style.color in ((0, 1, 0), '#00ff00')
assert data.style.marker == 'o'
assert_allclose(data.style.markersize, 3) # Glue default
assert_allclose(data.style.alpha, 0.8)
Expand All @@ -317,7 +317,7 @@ def test_mvp_markers(self):
assert self.viewer.layers[3].state.fill is False

# Make sure the other marker is not changed.
assert self.imviz.app.data_collection[2].style.color == '#ff0000'
assert self.imviz.app.data_collection[2].style.color in ('red', '#ff0000')
assert self.viewer.layers[2].state.fill is True

# TODO: How to check imviz.app.data_collection.links is correct?
Expand Down
4 changes: 4 additions & 0 deletions jdaviz/configs/mosviz/tests/test_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
# For data-loading tests, see test_data_loading.py

import csv

import pytest
from numpy.testing import assert_allclose

from jdaviz.configs.specviz2d.helper import Specviz2d
from jdaviz.utils import NUMPY_LT_2_0


@pytest.mark.skipif(not NUMPY_LT_2_0, reason="https://github.com/pandas-dev/pandas/issues/54505")
def test_to_csv(tmp_path, mosviz_helper, spectrum_collection):
labels = [f"Test Spectrum Collection {i}" for i in range(5)]
mosviz_helper.load_1d_spectra(spectrum_collection, data_labels=labels, add_redshift_column=True)
Expand Down
4 changes: 4 additions & 0 deletions jdaviz/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
from jdaviz import __version__, Cubeviz, Imviz, Mosviz, Specviz, Specviz2d
from jdaviz.configs.imviz.tests.utils import create_wfi_image_model
from jdaviz.configs.imviz.plugins.parsers import HAS_ROMAN_DATAMODELS
from jdaviz.utils import NUMPY_LT_2_0

if not NUMPY_LT_2_0:
np.set_printoptions(legacy="1.25")

SPECTRUM_SIZE = 10 # length of spectrum

Expand Down
4 changes: 2 additions & 2 deletions jdaviz/core/astrowidgets_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def add_markers(self, table, x_colname='x', y_colname='y',
Invalid marker name.
"""
from glue_jupyter.bqplot.scatter.layer_artist import BqplotScatterLayerState
from glue.viewers.scatter.state import ScatterLayerState

if marker_name is None:
marker_name = self._default_mark_tag_name
Expand Down Expand Up @@ -489,7 +489,7 @@ def add_markers(self, table, x_colname='x', y_colname='y',
# Only can set alpha and color using self.add_data(), so brute force here instead.
# https://github.com/glue-viz/glue/issues/2201
for lyr in self.state.layers:
if isinstance(lyr, BqplotScatterLayerState) and lyr.layer.label == marker_name:
if isinstance(lyr, ScatterLayerState) and lyr.layer.label == marker_name:
for key, val in self.marker.items():
setattr(lyr, {'markersize': 'size'}.get(key, key), val)
break
Expand Down
3 changes: 3 additions & 0 deletions jdaviz/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import matplotlib.pyplot as plt
from astropy.io import fits
from astropy.utils import minversion
from ipyvue import watch
from glue.config import settings
from glue.core.subset import RangeSubsetState, RoiSubsetState
Expand All @@ -13,6 +14,8 @@
__all__ = ['SnackbarQueue', 'enable_hot_reloading', 'bqplot_clear_figure',
'standardize_metadata', 'ColorCycler', 'alpha_index', 'get_subset_type']

NUMPY_LT_2_0 = not minversion("numpy", "2.0.dev")

# For Metadata Viewer plugin internal use only.
PRIHDR_KEY = '_primary_header'
COMMENTCARD_KEY = '_fits_comment_card'
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ isolated_build = true
setenv =
MPLBACKEND=agg
JUPYTER_PLATFORM_DIRS=1
devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple

# Pass through the following environment variables which may be needed for the CI
passenv = HOME,WINDIR,LC_ALL,LC_CTYPE,CC,CI
Expand Down Expand Up @@ -44,6 +44,7 @@ deps =
# NOTE: Add/remove as needed
devdeps: scipy>=0.0.dev0
devdeps: numpy>=0.0.dev0
devdeps: astropy>=0.0.dev0
devdeps: git+https://github.com/astropy/regions.git
devdeps: git+https://github.com/astropy/specutils.git
devdeps: git+https://github.com/astropy/photutils.git
Expand All @@ -68,7 +69,6 @@ extras =
alldeps: all

commands =
devdeps: pip install -U -i https://pypi.anaconda.org/astropy/simple astropy --pre
jupyter --paths
pip freeze
!cov: pytest --pyargs jdaviz {toxinidir}/docs {posargs}
Expand Down

0 comments on commit 4bcc1b1

Please sign in to comment.