force-h2020 / force-bdss

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

TST/FIX: Suggested fixes to TestBaseDataSourceModel class #327

Closed flongford closed 4 years ago

flongford commented 4 years ago

Includes fixes to mocked objects that ensure both TestBaseDataSourceModel.test_bad_factory and TestBaseDataSourceModel.test_bad_slots are asserting that the correct Exceptions have been raised.

Previously, an error was being generated in the invocation of self.mock_factory.create_data_source, related to a missing plugin_id attribute on the mocked BaseDataSourceFactory class. This then prevented any further code from being tested.

This has now been resolved, with testfixtures.LogCapture used to check the logs and tidy up the unit test traceback.

Note:

I couldn't get the capture.check call to work in test_bad_slots (string formatting I expect), so I left it out. The LogCapture context manager is still used, since it prevents the log statements from cluttering up the unit test output.

codecov[bot] commented 4 years ago

Codecov Report

Merging #327 into change-verification-message will increase coverage by 0.05%. The diff coverage is n/a.

Impacted file tree graph

@@                       Coverage Diff                       @@
##           change-verification-message     #327      +/-   ##
===============================================================
+ Coverage                        98.27%   98.33%   +0.05%     
===============================================================
  Files                               60       60              
  Lines                             1686     1686              
  Branches                           170      170              
===============================================================
+ Hits                              1657     1658       +1     
+ Misses                              24       23       -1     
  Partials                             5        5              
Impacted Files Coverage Δ
force_bdss/data_sources/base_data_source_model.py 100.00% <ø> (+1.69%) :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 f64750a...c79806f. Read the comment docs.