-
Notifications
You must be signed in to change notification settings - Fork 0
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
Dem module tests #48
Dem module tests #48
Conversation
@fnattino This PR sets up limited tests for the functionalities in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for starting this @meiertgrootes! Once #42 is merged, I can add some test data to the package (#49), which we can use for testing.
tests/testthat/test-valley.R
Outdated
|
||
expect_equal(valley, expected_valley, tolerance = 1e-4) | ||
|
||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}) | |
}) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @meiertgrootes! I made a few additional commits:
- merged the package data from Add packaged DEM data #51
- replaced placeholders with package data in the tests
- created test data for the last test
A few things left to do:
-
We should mock the API calls in the first two tests and allow them to run on CI. I will try this with the
mockery
package. -
When dropping the
skip_on_ci()
from the last test, I've encountered some issues, will try to fix them and get back with an update.
This is done.
@fnattino, I am having issues with accessing I also tried without
I know you tried once using test data under the |
Co-authored-by: Francesco Nattino <[email protected]>
Co-authored-by: Francesco Nattino <[email protected]>
Follwing the suggestion in #48 (comment)
@fnattino thanks for the review! After implementing the suggested changes, I still see |
So annoying.. By googleing a bit I found that in this package very simple relative links seems to work: https://github.com/jeroen/openssl/blob/master/tests/testthat/test_cert.R So can we try to do: expected_valley <- sf::st_read("./testdata/expected_valley.gpkg",
quiet = TRUE) |>
sf::st_as_sfc() Locally tests pass.. |
I tried this too, and I get the same results: locally tests pass and CI check fails. |
That package also has the This should add the tests (and testdata) to the build, maybe is this the solution? If this does not work as well we might consider whether we actually want to remove the data.. |
@fnattino the |
The following should allow for some tolerance. The "exact" means that the two features are used as-they-are, so vertices need to be ordered in the same way. The "par" argument actually set the tolerance for equality: sf::st_equals_exact(geometry1, geometry2, par =1.e-4, sparse = FALSE) |
@fnattino that was it. I had to adjust the precision of the two objects. All checks seem to be passing. If you agree, we can merge this now. |
Thanks for all the effort with this @cforgaci - this was quite more painful than anticipated.. go ahead and merge for my side! |
limited test suite framework for
valley.R