Skip to content

Develop standard method to access test data files #6683

Open

Description

@mhvk

In #6664, there was some discussion how to access test data in documentation. It would seem handy to have a general method. In #6664 (comment), I wrote and suggested:

I think there is a general question here of how to access test data files. In a package of my own, I "solved" it by having an __init__.py for my data directory that defines variables that hold the paths to the various files, which then can be imported [1]. Not sure that this scales to all of astropy, but I think that instead of

fits_scaledimage_filename = fits.util.get_testdata_filepath('scale.fits')

it is clearer what happens if one sees,

from fits.test_data import scaled_image_file

Another advantage is that it allows the test data files to have docstrings, which can be typeset with sphinx (and I guess with suitable cleverness be made part of the instance).

[1] https://github.com/mhvk/baseband/blob/master/baseband/data/__init__.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions