ucphhpc / migrid-sync

MiGrid workspace where master branch is kept strictly in sync with SF upstream svn repo. Any development or experiments should use a branch. You probably want to fork your own clone or work e.g. on the edge branch if you wish to contribute.
GNU General Public License v2.0
4 stars 4 forks source link

Extend MigTestCase such that it can provide a configuration object. #126

Closed albu-diku closed 1 month ago

albu-diku commented 2 months ago

A great deal of code that we wish to exercise under test requires a configuration object. The wiring to generate test configuration values is already in tree, but actually consuming it in tests was done in an ad-hoc fashion. Meanwhile the separate notion of a FakeConfiguration was added primarily to allow exercising code that needs a specific subset of vars set with specific values.

This patch raises this use-case to the level of the common support library. Use the way a logger was exposed as a blueprint and add a configuration property to MigTestCase - this is a computed property that lazily creates a (by default) FakeConfiguration object.

This object persists for the duration of the test. Provide a means for easily overriding this to make it a fully populated Configuration instance using the testconfig - this mechanism is declarative such that the details of configuration loading are transparent to callers. Document this use via an extra test case in the support library tests.

jonasbardino commented 1 month ago

Merged through svn with the review docstring comment addressed. Also added the missing copyright header to test_support.py and fixed the 'configuraed' typo in a comment. Those edits resulted in minor autopep8 adjustments to wrap long lines and tweak white space.