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

Fix type scheduled-tests.yml #411

Merged
merged 4 commits into from
Oct 17, 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
2 changes: 1 addition & 1 deletion .github/workflows/scheduled-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:

- name: Test with pytest
run: |
pytest -s tests/scheduled_tests.py
pytest -s tests/scheduled_checks.py
6 changes: 3 additions & 3 deletions tests/scheduled_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pytest
import sys
import requests
from tqdm import tqdm
from astrodbkit2.astrodb import create_database, Database
from scripts.ingests.utils import check_internet_connection

Expand Down Expand Up @@ -53,14 +54,13 @@ def test_spectra_urls(db):
codes = []
internet = check_internet_connection()
if internet:
for spectrum_url in spectra_urls["spectrum"]:
for spectrum_url in tqdm(spectra_urls["spectrum"]):
request_response = requests.head(spectrum_url)
status_code = request_response.status_code
# The website is up if the status code is 200
# cuny academic commons links give 301 status code
if status_code != 200 and status_code != 301:
broken_urls.append(spectrum_url)
codes.append(status_code)
assert (
len(broken_urls) == 149
assert (149 <= len(broken_urls) <= 150
), f"found {len(broken_urls)} broken spectra urls: {broken_urls}, {codes}"