force-h2020 / force-bdss

Business Decision System general interface
BSD 2-Clause "Simplified" License
2 stars 2 forks source link

change local error message for input/output verification #326

Closed sparsonslab closed 4 years ago

sparsonslab commented 4 years ago

Closes #324. Changed local error message for check on no. of inputs/outputs, in BaseModelDataSource.verify(). Message conforms with verification in ExecutionLayer.execute_layer() (corresponding parts of this now removed).

Corresponding changes to unit tests (includes fixes from #327).

codecov[bot] commented 4 years ago

Codecov Report

Merging #326 into master will increase coverage by 0.05%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #326      +/-   ##
==========================================
+ Coverage   98.28%   98.33%   +0.05%     
==========================================
  Files          60       60              
  Lines        1687     1686       -1     
  Branches      171      170       -1     
==========================================
  Hits         1658     1658              
+ Misses         24       23       -1     
  Partials        5        5              
Impacted Files Coverage Δ
force_bdss/core/execution_layer.py 100.00% <ø> (ø)
force_bdss/data_sources/base_data_source_model.py 100.00% <100.00%> (+1.78%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update eba28aa...af9d0df. Read the comment docs.

sparsonslab commented 4 years ago

codecov/project is weird, right??

It just says "everything is accounted for"

flongford commented 4 years ago

codecov/project is weird, right??

It just says "everything is accounted for"

Yes... it can be very unhelpful at times. The only line I can see in BaseDataSourceModel that is not being covered is line 95 (raise exception if BaseDataSource.slots method fails), which is not touched by this PR.

If you were able to include a quick test for this, then it will likely stop complaining.

Having said that, it looks like there IS already a test in test_base_data_source_model.py doing just that!

flongford commented 4 years ago

Having said that, it looks like there IS already a test in test_base_data_source_model.py doing just that!

Ok, after so experimenting a bit I think the TestBaseDataSourceModel.test_bad_slots method is not working properly. The message coming back from the Exception being raised is "Mock object has no attribute 'plugin_id'", whereas we would expect "bad slots" to be returned.

There might be a bit to much mocking being used - I will see if I can simplify things (#327)