clear AND reload analysis config on tests’ tearDown #1003
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are several tests that call
etc.set_analysis_config
in theirsetUp()
to set config options in certain testing scenarios. This creates a config file, and in tearDown of each test the config file is deleted via os.remove.However, just deleting the file is not enough!
When emission.analysis.config is intialized, we read the config and cache it in a variable
config_data
e-mission-server/emission/analysis/config.py
Line 19 in 4034533
config_data
, which can be out of sync with the contents of the config file if the config file was added/removed/modified andreload_config()
was not called. So instead of just callingos.remove()
these tests also need to callreload_config()
in theirtearDown()
.Added this by way of a new function in
emission.tests.common
Also, I made the config file pathnames into constants for tidiness and to eliminate the risk of typo-related bugs