-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
g.extension: add tests for download from various sources #1158
Conversation
See also #625 |
Any opinion on this? |
Testing it with Python 3.9.4 shows:
Could that be updated? Then some tests fail since which leads to
|
Using We should probably remove the requirement to specify |
That sounds like pygrass is broken, not the g.extension interface. |
This is tricky either way. Not running the tests when we have them? Unfortunate. Not for datasets and normal tests, but in general, downloading is okay in the CI and we do it (dependencies, sample dataset). It may fail time to time due to 3rd party issues and that's fine. I would say, let's have it enabled and fix it when it doesn't work. (An alternative is having a separate GitHub Action or job which will do this special test.) The URLs it is reaching should be somewhat reliable and perhaps under our control. For example, we have the alternative GRASS org on GitHub. |
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 is still couple of r.plus.example
.
I don't get the reasons for the MS Win test. Can you comment more in the code?
r.clip, perhaps a candidate to be moved to core like v.clip? Maybe a different module would be a better match for this test. Also one Python and one C module might be a good idea.
Yet all tests pass locally. I think the module name is not relevant if you install from single module repositories, as the URL is build just with the repo name... But I wil change that so it is more clean...
When writing the tests, I thought there were no tests on MS Windows. On MS Windows, installation is mainly downloading and extracting a zip file, so the tests checks the windows specific functions for that on Linux.
Yes, agreed. Will change that. |
Agreed.
Thanks, that makes sense.
I didn't think about that. The check is performed when a module runs, but I don't think modules run during Windows installation, so we may be okay as long as the download links are resolved properly.
Unfortunate situation. Well, good to know about it.
It is definitively more advanced test than I would write. I guess I would just add some secret flag (not a g.parser one) to g.extension, but this seems too be more general and it does not mess up the interface and tests can be outside of the already long module code. There might be value in testing things this way, e.g., you can test locally on Linux. On the other hand, if it makes things more complicated and the same functionality is easily tested elsewhere, I would not keep it for simplicity. |
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.
The commit message says add C module, but it changes the module tested in the official module test instead of having two tests. Intentional?
The failing test does not seem to be related to this PR. |
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.
This seems to have a lot of files which are not related to the PR and likely not really part of the source code at all. Accidental git -A
?
1a6fea5
to
2160576
Compare
Hm, it may have been due to a merge commit, but I am not sure. Tried to solve it with a hard reset. Hope that is an acceptable fix for the issue... |
With OSGeo4W tests in CI, I am all fine with removing the MS Windows test function, if that is preferable. |
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. I have nothing too serious except perhaps one item. It could go in as is, but I think some things could be modernized further.
Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
There are still some issues with the tests on MS Windows, but I will address them with a more concentrated crack down on unittest issues on that OS... |
* add download test (skipped by default) * skip by default * correct testfile name in header * remove unused variables * add test for bundeled modules * address review * reset branch * replace importlib * apply more recent black * address comments from code review * fix test failure, remove unnecessary, unstable test * skip tests that cannot run on MS Windows * add reason for skiping tests * Update scripts/g.extension/testsuite/test_addons_download.py Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com> * address more code review * add docstring * test addon start and adjustments for MS Windows * fixes for MS Windows Co-authored-by: ninsbl <stefan.blumentrath@nina.no> Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
* add download test (skipped by default) * skip by default * correct testfile name in header * remove unused variables * add test for bundeled modules * address review * reset branch * replace importlib * apply more recent black * address comments from code review * fix test failure, remove unnecessary, unstable test * skip tests that cannot run on MS Windows * add reason for skiping tests * Update scripts/g.extension/testsuite/test_addons_download.py Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com> * address more code review * add docstring * test addon start and adjustments for MS Windows * fixes for MS Windows Co-authored-by: ninsbl <stefan.blumentrath@nina.no> Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
* add download test (skipped by default) * skip by default * correct testfile name in header * remove unused variables * add test for bundeled modules * address review * reset branch * replace importlib * apply more recent black * address comments from code review * fix test failure, remove unnecessary, unstable test * skip tests that cannot run on MS Windows * add reason for skiping tests * Update scripts/g.extension/testsuite/test_addons_download.py Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com> * address more code review * add docstring * test addon start and adjustments for MS Windows * fixes for MS Windows Co-authored-by: ninsbl <stefan.blumentrath@nina.no> Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
This PR adds test for downloading addons from:
Cause I was not sure if tests that download content from the internet are acceptable I deactivated tests by default. So devs would have to activate them by setting skip to False.