-
Notifications
You must be signed in to change notification settings - Fork 41
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
Automated testing for the new REMIND Library #2
Conversation
- included is a fulldata.gdx from a REMIND-EU run. Testing against this GDX fails at the moment. - if there are no GDX in `tests/testgdxs`, checks are skipped.
sure |
There is now a line at the beginning of the test that can be uncommented to skip the test. |
@Loisel I am getting this error while trying to build the library: `
` Shouldn't the gdx test be shipped together with the library if you want to have an automated test? Also, in order to not wait forever for the test to be done at every commit, couldn't you simply test the mif creation with just one region instead of all regions contained in the gdx file? This would require some adjustment to the convGDXMIF function but I don't really see the point of waiting forever to build the library for each commit, even if it is just a small change. I would disable for now this feature and add it as a question in the buildLibrary script to make it easier to enable or disable and avoid these issues. |
This is not possible unfortunately, that's why Alois implemented the automatic download.
I think that tests should run for all regions (what if e.g. values only for a certain region don't add up?), or at lease people should be able to run the tests for all regions if they want to. The gain comes from the library remaining functional almost always, compared to now where every now and then it breaks and people have to restart jobs on the cluster etc etc. You lose some time waiting for the tests (which you can disable for fast intermediate build checks and leave for the last step before committing) but gain overall stability and thus, time.
Disabling the feature means people will just not do it so we are back at no testing. And buildlibrary is in essence exactly that, a question and check if the package builds correctly. |
An interesting catch. I suppose the problem is due to line endings on windows. I added a PR #5 which explicitly specifies "binary mode" for the downloads. Please try it out! |
The convGDX2mif is region agnostic. That is a requirement to make it compatible with REMIND21 (REMIND-EU) and REMIND H12 at the same time. Testing it with a gdx with only two regions, 12 regions and/or 21 regions shouldn't make any difference except for the runtime to run the function. If that is not the case somehow, the code needs to be fixed.
I would still request, if it is not existent already, to add a parameter to the buildLibrary function to disable further tests if the user is aiming only debugging the library and not necessarily commit the changes yet. |
Why would you want to build the library then? Does "for debugging" mean, that you want to install & use the library? Please remember that you can always just |
Regions: I agree, the regions can be reduced to a small set of regions. Disabling tests: For disabling the tests I am still not convinced that this is the right way to go, and opened an issue for further discussion: pik-piam/lucode2#7. I agree with Alois' comment above, in RStudio this is |
@Loisel and @giannou |
[ Since disabling the tests is not possible with buildlibrary: https://github.com/pik-piam/lucode2/issues/7 ] As I said before, in the current implementation of the REMIND reporting, automated tests is the only way to prevent breaking the remind2 package every now and then and loosing time restarting jobs and regenerating results. Some options I see:
|
I'd opt for uncommenting the line. Advantages:
@Renato-Rodrigues I see the point for a case where there are a lot of code check issues. Then, the code checks are required and should run quickly. But for (most) smaller changes I'd not expect many code check issues. For the exceptional case that there is an integration of larger chunks of code I'd say it is not asked too much to uncomment the line. |
My opinion is that the code line commenting is a hack, instead of a code feature. |
In your Rstudio project options you can add an option to not run tests when you use the Check button (or Ctrl+Shift+E) in RStudio but the tests will run when using buidlibrary: Would that work for you? So you can basically do your code development and intermediate checking for warnings with Ctrl+Shift+E (faster than typing commands) and when you are ready to commit run |
I could give it a try, but my intention was never to disable every check, only the ones that rely in long gdx tests for now. |
as another idea: testthat comes with various functions to skip certain tests under certain condition (e.g. And if you want to make the tests faster but do not want to get of the full reporting test for now I want to second Renato here in his suggestion to test it only for a single region. |
The warnings that you were referring to before are still generated when you disable the tests. They come from problems in the R code, not from the calculations. |
I am aware of the skip_ functions but this would again mean a user has to actively change something somewhere to disable the slow tests, no? As for the 1-region GDX, that'd be nice (but not sure how much it would speed up the slow tests), I am looking into ways to do that but it's not trivial. |
When I have outdated tests lying around for other projects, I often have to skip them for the time being. This always involves these kind of hacks. I also mentioned the possibility to uncomment this line in the README, but it is likely that nobody reads them. On the other hand, if we want to have some more test coverage in the future, people will get used to these kinds of "workaround", whether we like it or not. |
…_findAMTgdx clean up .findAMTgdx() for readability
The test tries to create a reporting for a GDX from here:
/p/projects/remind/users/renatoro/REMIND-EU_Calibration/v12_2021_02_10_mergeVersion/output/SSP2-Base_2021-02-10_15.40.32/fulldata.gdx
. The GDX is hosted by RSE and downloaded from there for the test.tests/testgdxs
, no download takes place in the provided GDX is used.A test on correct summation of |+| variables is in preparation by @giannou .