-
-
Notifications
You must be signed in to change notification settings - Fork 307
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
tests: Call t.remove and g.remove once with multiple inputs as list #4523
Conversation
One call per type, when all other arguments are the same
One call per type, when all other arguments are the same
I am pretty sure you can use lists here. |
+1 for the lists. If |
If it doesn't work, there's a bigger problem, as it is used at multiple places. I'll try to do the changes next time I have time to code :) |
This PR should help squeeze out a couple of seconds of testing time by calling t.remove or g.remove once with multiple inputs separated by a comma, when all other parameters are the same. For t.remove, I combined the layers in the
inputs
argument with a comma, and for g.remove, I combined the names of the files of thename
argument. I referred to https://grass.osgeo.org/grass85/manuals/t.remove.html and https://grass.osgeo.org/grass85/manuals/g.remove.html.I tried to keep using a manual string concatenation to be as close as the usage shown in the docs. However, when changing g.remove usages, I saw that, at least in gunittests
self.runModule
,name
could be passed a list or a tuple for a similar effect. I tried to follow the call chain forrunModule
, but couldn't pinpoint with precision where that conversion happened. So, I kept the changes safe and close to the existing tests. If you can show me how safe it is to pass a list (or tuple), some changes could be made simpler.Last week I benchmarked a single test in
t.rast.accumulate
and these changes had a measurable impact, being 1.18x faster (when combined with removing unusedSimpleModule
import, like filed in #4521).I still kept the test prefix in the title, even if some changes are for benchmarks, and one change in utils/thumbnails.py