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

TST: Add RC testing workflow and update existing #1909

Merged
merged 4 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .github/workflows/ci_cron_weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
# run at 9am UTC on Mondays
- cron: '0 9 * * 1'

permissions:
contents: read

jobs:
# The linkcheck job tests that the links in the docs point to real places
# The if statement is to prevent cron from running on forks.
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
# Github Actions supports ubuntu, windows, and macos virtual environments:
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
# run every Monday at 3am UTC
- cron: '0 3 * * 1'

permissions:
contents: read

jobs:
analyze:
name: Analyze
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/predeps_workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: rc-testing

on:
workflow_dispatch:
schedule:
# run at 9am UTC on Tuesdays
- cron: '0 9 * * 2'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
# Github Actions supports ubuntu, windows, and macos virtual environments:
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
ci_tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:

- name: RC testing on Linux with remote data
os: ubuntu-latest
python: '3.11'
toxenv: py311-test-predeps
toxposargs: --remote-data

- name: RC testing on OSX
os: macos-latest
python: 3.9
toxenv: py39-test-predeps

- name: RC testing on Windows
os: windows-latest
python: '3.10'
toxenv: py310-test-predeps

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up python ${{ matrix.python }} on ${{ matrix.os }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install base dependencies
run: python -m pip install --upgrade pip tox
- name: Test/run with tox
run: tox -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }}
20 changes: 18 additions & 2 deletions jdaviz/configs/imviz/plugins/catalogs/catalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import numpy as np
import numpy.ma as ma
from astropy import units as u
from astropy.table import QTable
from astropy.coordinates import SkyCoord
from traitlets import List, Unicode, Bool, Int, observe

from jdaviz.configs.default.plugins.data_tools.file_chooser import FileChooser
from jdaviz.core.events import SnackbarMessage
from jdaviz.core.registries import tray_registry
from jdaviz.core.template_mixin import (PluginTemplateMixin, ViewerSelectMixin,
SelectPluginComponent)
Expand Down Expand Up @@ -127,11 +129,25 @@ def search(self):
# conducts search based on SDSS
if self.catalog_selected == "SDSS":
from astroquery.sdss import SDSS
r_max = 3 * u.arcmin

# queries the region (based on the provided center point and radius)
# finds all the sources in that region
query_region_result = SDSS.query_region(skycoord_center, radius=zoom_radius,
data_release=17)
try:
if zoom_radius > r_max: # SDSS now has radius max limit
self.hub.broadcast(SnackbarMessage(
f"Radius for {self.catalog_selected} has max radius of {r_max} but got "
f"{zoom_radius.to(u.arcmin)}, using {r_max}.",
color='warning', sender=self))
zoom_radius = r_max
query_region_result = SDSS.query_region(skycoord_center, radius=zoom_radius,
data_release=17)
except Exception as e: # nosec
self.hub.broadcast(SnackbarMessage(
f"Failed to query {self.catalog_selected} with c={skycoord_center} and "
f"r={zoom_radius}: {repr(e)}", color='error', sender=self))
query_region_result = None

if query_region_result is None:
self.results_available = True
self.number_of_results = 0
Expand Down
9 changes: 5 additions & 4 deletions jdaviz/configs/imviz/tests/test_catalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ def test_plugin_image_with_result(self, imviz_helper, tmp_path):
catalogs_plugin.plugin_opened = True
catalogs_plugin.vue_do_search()

# number of results should be > 0
# '2473' was determined by running the search with the image in the notebook
# number of results should be > 500 or so
# Answer was determined by running the search with the image in the notebook.
assert catalogs_plugin.results_available
assert catalogs_plugin.number_of_results == 2473
assert catalogs_plugin.number_of_results > 500
prev_results = catalogs_plugin.number_of_results

# testing that every variable updates accordingly when markers are cleared
catalogs_plugin.vue_do_clear()
Expand All @@ -116,7 +117,7 @@ def test_plugin_image_with_result(self, imviz_helper, tmp_path):
assert catalogs_plugin.catalog.selected == 'From File...'
catalogs_plugin.vue_do_search()
assert catalogs_plugin.results_available
assert catalogs_plugin.number_of_results == 2473
assert catalogs_plugin.number_of_results == prev_results


def test_from_file_parsing(imviz_helper, tmp_path):
Expand Down
6 changes: 5 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{38,39,310,311}-test{,-alldeps,-devdeps}{,-cov}
py{38,39,310,311}-test{,-alldeps,-devdeps,-predeps}{,-cov}
linkcheck
codestyle
pep517
Expand Down Expand Up @@ -71,6 +71,10 @@ commands =
cov: pytest --pyargs jdaviz {toxinidir}/docs --cov jdaviz --cov-config={toxinidir}/setup.cfg {posargs}
cov: coverage xml -o {toxinidir}/coverage.xml

pip_pre =
predeps: true
!predeps: false

[testenv:linkcheck]
changedir = docs
description = check the links in the HTML docs
Expand Down