-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Document Extended Testing Data Requirements #27
Comments
Just documenting one simple way to implement this functionality by adding the following function to quantecon utils package: def package_folder(__file__, localdir):
"""
Simple locator for finding package folders
Parameters
----------
__file__ : pass in the file location
localdir : specify the directory name
(i.e. 'data' if calling file is in tests/ this will return absolute reference for tests/data)
Returns
-------
path : absolute path to package sub-directory
Notes
-----
[1] This only works for local sub-directories (which is the majority of use cases)
"""
this_dir, this_filename = os.path.split(__file__)
path = os.path.join(this_dir, localdir)
return check_directory(path) Then import: fn = util.package_folder(__file__, 'data') + fn this will return the package level absolute reference for a sub-directory 'data' from where it is called within the package. However if there are a lot of files to read this will significantly slow down the tests. Therefore, it is probably better to hold off for now and use a hdf5 file container for a single interaction with the filesystem. Note: The check_directory method is a simple directory checker. |
Hey @sanguineturtle I have needed some data as I have been writing tests. For now I am just using a file at I have a few functions in Does the addition of these tools resolve this issue? |
@spencerlyon2 Great set of utilities! I am fairly new to Function:
Integrity of Data:
Git Considerations:
If we end up using an external |
@spencerlyon2 This def test_something():
some test here
test_something.extdata = True If we assign this attribute to a function then we can
I use this to demarcate between |
That approach does work. Another one that I have been using (see here and here) is doing the import Then I can run We can also write a little makefile that has declarations for running all (probably the default), running a particular module (can you pass extra arguments to a makefile? something like |
Indeed. Re: Perhaps we should just write a @cc7768 What does Continuous Travis do? Does it need a config script if we want to specify subsets of tests or does it just run all tests? |
@sanguineturtle @spencerlyon2 You can see exactly what Continuous Travis does in the .travis.yaml file that is in the tests branch. Right now, all it does to run tests is |
@sanguineturtle I think just writing a python script is a good way to go. We can just make it executable and it would do all of what I was thinking to use make for. Good suggestion |
@sanguineturtle, does this issue need to be open still? |
@spencerlyon2 I guess I am still not clear on how we are managing the HDF data file? I know we have one but should we consider versioning it etc. (How do we add data to it etc). In my recent experience with HDF, small things like concurrent access can corrupt files. I think a number of items from my comments above aren't fully resolved so it would be worth leaving this open. |
@spencerlyon2 Re |
I don't have any docs written for dealing with it. Whenever I have made updates they have been directly with python -- not any other application. Also, I did a quick scan through the repo and can't see the file you mention. Any idea where it went? |
I have it on my local machine. It seems to be referenced in util.py: data_file = join(data_dir, "testing_data.h5") It was deleted August 08, 2014. Does this need to be reinstated? |
I don't think so. i think what we decided was to not have this file checked into git. Then the first time you run the tests it will be created for you so you have a local cache of data (see here). |
@spencerlyon2 Oh I think I understand now. This is really just a container for storing results then rather than persistent data used for testing? |
Yep. It just speeds up the running of the tests If the file is missing, it will be generated when you run the tests. |
@spencerlyon2 Great - thanks. Therefore we don't really need documentation to show how to populate the object. I had assumed there were data tables included and hence why I thought it should be version controlled etc. Closing Issue. |
This Issue is to collect any Data Requirements we may think when writing tests, that will demand infrastructure for importing a data file etc.
The text was updated successfully, but these errors were encountered: