-
Notifications
You must be signed in to change notification settings - Fork 151
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
Add tests to pysteps modules #32
Comments
I just ran pytest but got 2 errors. Is my new installation good for use?
|
Hi @aperezhortal, I have started to work in a Travis CI configuration for pysteps. So far, this configuration However, when I try to import pysteps before to run any tests I got the following error message:
https://travis-ci.org/cvelascof/pysteps/jobs/502472265#L1488 I guess that there is something incorrect in the way that cython compiles |
Maybe you need to make the module searchable from your python by, say, exporting PYTHONPATH=...? |
This seems related to the problem discussed in Issue #40. |
I forgot that I raised that issue. :) |
Yes. Thanks. That did the trick. Running the tests from https://travis-ci.org/cvelascof/pysteps/builds/502524712 I will do a merge request soon. |
@aperezhortal, @dnerini have you tried to run the test_motion outside of Travis? I mean in your own computer. In my case, test_motion is taking so much time to run. It passes but in comparison with the other tests is sooooo slow. |
Yes, I run the tests locally on my computer and it is true that test_motion takes some time, mostly because it has to compute multiple times VET and make sure that it converges to the right solution (by increasing the number of iterations). But are you sure that is used to be faster? Perhaps one way to speed up the test could be to reduce the dimension of the domain (e.g. upscaling the reference field). |
@cvelascof, that test indeed takes some time. I will test upscaling the reference fields as @dnerini suggested to speed up the tests. Hopefully, it will be straightforward. |
@aperezhortal thanks. that would be nice to have. |
@cvelascof @dnerini, I tried upscaling the domain by 2, but the quality of the VET field was much lower. It converges to a local minimum... This is a temporary patch, while I look for a way to optimize the _vet module. ( 24e4f8a ) |
Good news: we have (finally) achieved more than 50% coverage! |
Let's set a 90% coverage goal for pysteps V2. |
Now, the pySTEPS tests are mostly done by running the examples. It is a good idea to implement scripts that test different functions. A good and simple testing framework is pytest.
By doing so, we can test the library after any change that we want to commit.
One of the best advantages of implementing these tests is that we can set continuous integration service used to build and test projects hosted at GitHub, like Travis-CI. This is used for example in py-art.
Many of the CI servers support integration with github. By doing so, after each commit, the tests can be run under different environments and the results are visible in the commits tab in github (see pyart green checks for example ). Also, the pull request can be automatically tested before merging.
I created a branch with a script to test the interfaces as an example: https://github.com/aperezhortal/pysteps/tree/tests/test
To run this tests, execute pytest in the test folder (pytest package is needed).
The output looks like this:
The text was updated successfully, but these errors were encountered: