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: Use tmp_path in test_autoconfig #2481

Merged
merged 1 commit into from
Sep 27, 2023
Merged
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
25 changes: 11 additions & 14 deletions jdaviz/core/tests/test_autoconfig.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Tests automatic config detection against our example notebook data

from pathlib import Path
from tempfile import TemporaryDirectory

import pytest
from astroquery.mast import Observations
Expand All @@ -28,22 +27,20 @@
@pytest.mark.remote_data
@pytest.mark.filterwarnings('ignore')
@pytest.mark.parametrize('uris', AUTOCONFIG_EXAMPLES)
def test_autoconfig(uris):
# Setup temporary directory
with TemporaryDirectory(ignore_cleanup_errors=True) as tempdir:
uri = uris[0]
helper_class = uris[1]
def test_autoconfig(uris, tmp_path):
uri = uris[0]
helper_class = uris[1]

if uri.startswith("mast:"):
download_path = str(Path(tempdir) / Path(uri).name)
Observations.download_file(uri, local_path=download_path)
elif uri.startswith("http"):
download_path = download_file(uri, cache=True, timeout=100)
if uri.startswith("mast:"):
download_path = str(tmp_path / Path(uri).name)
Observations.download_file(uri, local_path=download_path)
elif uri.startswith("http"):
download_path = download_file(uri, cache=True, timeout=100)

viz_helper = jdaviz_open(download_path, show=False)
viz_helper = jdaviz_open(download_path, show=False)

assert isinstance(viz_helper, helper_class)
assert len(viz_helper.app.data_collection) > 0
assert isinstance(viz_helper, helper_class)
assert len(viz_helper.app.data_collection) > 0


@pytest.mark.remote_data
Expand Down