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

Set up Continuous Integration and Unit Test Framework #14

Merged
merged 3 commits into from
May 11, 2020

Conversation

elbeejay
Copy link
Member

@elbeejay elbeejay commented May 8, 2020

From looking at some of the activity in the issues (#10, #11, #12), it sounds like there is interest in adding and expanding some of the features and functionality of RivGraph. I have some things I will likely need to add to the package as well. One of the 'task list' items is also to implement unit testing.

To help start all of that off, I thought it would be useful to get the package set up for continuous integration to ensure that proposed changes do not break the package. This pull request implements continuous integration via Travis CI, and provides the framework for automated unit testing and code coverage (could be done via Coveralls). An example "dummy" unit test is currently in the /tests folder as an example of how the file should be formatted.

Currently, the Travis set-up tests and successfully installs the package in Python 3.7 and 3.8. Note to @jonschwenk, after merging this pull request you should be able to add the Build Status badge to the Readme if you want.

Copy link
Member Author

@elbeejay elbeejay left a comment

Choose a reason for hiding this comment

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

Re: "make rivgraph imports relative, addition of titles to tops of files"

Small changes to make sure each file has a title so it is detected by the sphinx autodoc. Imports of RivGraph modules are made relative, so that installation of the package is not assumed/required. Helps for both documentation compilation and automated unit tests.


Re: "initialization of documentation"

Created skeleton documentation. Lot is left to fill in, but the auto-documentation (via Sphinx) seems to be working. Docs can be built locally by running make html from the command-line if you are in the docs folder.

@jonschwenk jonschwenk merged commit e6f5eee into VeinsOfTheEarth:master May 11, 2020
@jonschwenk
Copy link
Collaborator

jonschwenk commented May 11, 2020

@elbeejay Nice work! I have been fooling around with Sphinx, which is why the docs would build somewhat successfully.

Re: imports, that has been giving me a headache for awhile. Is the method you've implemented (using the path of the script) standard? I don't recall ever seeing that in other code, but I'm usually doing conda installs. Please note that the rivers and deltas subdirectories also have .py files with imports that should be fixed.

@elbeejay
Copy link
Member Author

That is a good question that I don't know the proper Pythonic or standard answer to. I just implemented something similar to the solution we had to use when building the unit tests for the evolving pyDeltaRCM code because I knew it would work (ex unit tests). For the main codebase we accomplished relative importing by pulling in classes with something like from .module_name import class_name (example module) but this wouldn't work to pull in all functions in a .py file the way we need to for RivGraph. So I guess in general this importing question is something to keep in mind in the event we find a better way of accomplishing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants