Skip to content

Improved external test data file handling#1828

Merged
bourque merged 8 commits intoIMAP-Science-Operations-Center:devfrom
bourque:improved-external-test-data-handling
Jun 24, 2025
Merged

Improved external test data file handling#1828
bourque merged 8 commits intoIMAP-Science-Operations-Center:devfrom
bourque:improved-external-test-data-handling

Conversation

@bourque
Copy link
Copy Markdown
Collaborator

@bourque bourque commented Jun 13, 2025

This PR changes how external test data files are defined -- I moved the list (which has grown quite large and may continue to grow) to its own file which is then imported into conftest.py. I also added some CoDICE validation files so that they can be stored in S3 instead of within the repo.

Closes #1537

@bourque bourque self-assigned this Jun 13, 2025
@bourque bourque added enhancement New feature or request Repo: Testing Related to testing labels Jun 13, 2025
@bourque bourque changed the title [WIP] Improved external test data file handling Improved external test data file handling Jun 13, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Moves the growing list of external test data file paths into a dedicated config file and updates fixtures and tests to use it.

  • Extracted the external test data list into external_test_data_config.py
  • Updated _download_external_data fixture in conftest.py to import and iterate over EXTERNAL_TEST_DATA
  • Cleaned up test_codice_l1a.py by removing manual download calls and adjusting the fixture return type

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.

File Description
imap_processing/tests/external_test_data_config.py New config module listing external test data files
imap_processing/tests/conftest.py Fixture now uses EXTERNAL_TEST_DATA, removed old helper method
imap_processing/tests/codice/test_codice_l1a.py Fixture signature updated to return list[xr.Dataset]
Comments suppressed due to low confidence (2)

imap_processing/tests/conftest.py:110

  • The docstring still refers to a test_data_paths parameter which no longer exists. Update it to describe that EXTERNAL_TEST_DATA is used directly.
    """This fixture downloads externally-located test data files into a specific

imap_processing/tests/codice/test_codice_l1a.py:121

  • [nitpick] Ensure your project runs on a Python version that supports built-in generic annotations (list[xr.Dataset]), or switch to from typing import List if compatibility is needed.
def test_l1a_data() -> list[xr.Dataset]:

Comment thread imap_processing/tests/conftest.py Outdated
Comment thread imap_processing/tests/external_test_data_config.py Outdated
@bourque bourque requested a review from tech3371 June 16, 2025 15:51
Copy link
Copy Markdown
Contributor

@tech3371 tech3371 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Contributor

@tmplummer tmplummer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am happy with this as is, but made one recommendation for a slight tweak to further reduce clutter in the new config file.

EXTERNAL_TEST_DATA = [

# CoDICE
("imap_codice_l0_raw_20241110_v001.pkts", imap_module_directory / "tests" / "codice" / "data" / "imap_codice_l0_raw_20241110_v001.pkts"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this looks like a nice improvement. I'm wondering if it would be worth taking it a step further to make the tuple for a single file contain (<s3_filename>, <parent_test_dir_relative_to_imap_module_dir>). That would clean up this configuration by removing the imap_module_directory as well as the target path filename. The later part would require that the filename remains the same when downloaded.

For this line, it would look like:

Suggested change
("imap_codice_l0_raw_20241110_v001.pkts", imap_module_directory / "tests" / "codice" / "data" / "imap_codice_l0_raw_20241110_v001.pkts"),
("imap_codice_l0_raw_20241110_v001.pkts", "tests/codice/data"),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I like it.

@bourque bourque merged commit d8de0ea into IMAP-Science-Operations-Center:dev Jun 24, 2025
14 checks passed
@bourque bourque deleted the improved-external-test-data-handling branch June 24, 2025 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Repo: Testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Store/download CoDICE validation files from S3

4 participants