pik-piam / remind2

The remind2 package contains the REMIND-specific routines for data and model output manipulation.
0 stars 40 forks source link

Improve reporting for failing summation checks in tests #536

Closed orichters closed 6 months ago

orichters commented 6 months ago

Dear @fbenke-pik, maybe you have a good idea how to improve the logging within the tests on failing summation checks. Currently, you get the following:

✔ |   2     13 | convGDX2mif [526.4s]
────────────────────────────────
Warning (test-convGDX2mif.R:94:5): Test if REMIND reporting is produced as it should and check data integrity
Summation checks have revealed some gaps! See `summation_errors` attribute on output for details.
Backtrace:
    ▆
 1. └─remind2::convGDX2MIF(gdxPath, gdx_refpolicycost = gdxPath) at test-convGDX2mif.R:94:4

It would be awesome if the messages coming from piamInterfaces about which summations fail would somehow be easily printed to the user in case the tests fails. Do you have a good idea how to do it?

0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q commented 6 months ago

Difficult. testthat is designed for unit tests, but we are doing integration tests with it. It will require to write custom expect_X() functions. See https://github.com/remindmodel/remind/pull/1424

fbenke-pik commented 6 months ago

It would be awesome if the messages coming from piamInterfaces about which summations fail would somehow be easily printed to the user in case the tests fails. Do you have a good idea how to do it?

Why not simply come up with a nice written summary printed to output in checkSummations and make it optional via a parameter (turned off by default)? Default would still be returning the table.

Alternatively, extend .reportSummationErrors in convGDX2mif?

orichters commented 6 months ago

@fbenke-pik: Agree, I think I can even implement that myself. Just let .reportSummationErrors raise a warning instead of a message.