diff options
author | André Erdmann <dywi@mailerd.de> | 2013-07-10 18:13:59 +0200 |
---|---|---|
committer | André Erdmann <dywi@mailerd.de> | 2013-07-10 18:13:59 +0200 |
commit | 176e55595664470938e81c75c6544bbec361442b (patch) | |
tree | 75fa519217344c244cde8308828686d51c2f2c67 | |
parent | roverlay/overlay/pkgdir: create all hashes at once (diff) | |
download | R_overlay-176e55595664470938e81c75c6544bbec361442b.tar.gz R_overlay-176e55595664470938e81c75c6544bbec361442b.tar.bz2 R_overlay-176e55595664470938e81c75c6544bbec361442b.zip |
roverlay/__init__.py: make logger setup optional
-rw-r--r-- | roverlay/__init__.py | 12 | ||||
-rw-r--r-- | tests/base.py | 4 |
2 files changed, 10 insertions, 6 deletions
diff --git a/roverlay/__init__.py b/roverlay/__init__.py index cd93ba1..7930c4a 100644 --- a/roverlay/__init__.py +++ b/roverlay/__init__.py @@ -30,16 +30,17 @@ def setup_initial_logger(): """Sets up initial logging.""" roverlay.recipe.easylogger.setup_initial() -def load_config_file ( cfile, extraconf=None ): +def load_config_file ( cfile, extraconf=None, setup_logger=True ): """ Loads the config, including the field definition file. Sets up the logger afterwards. (Don't call this method more than once.) arguments: - * cfile -- path to the config file - * extraconf -- a dict with additional config entries that will override - entries read from cfile + * cfile -- path to the config file + * extraconf -- a dict with additional config entries that will override + entries read from cfile + * setup_logger -- set up logger (defaults to True) """ roverlay_config = roverlay.config.access() @@ -51,7 +52,8 @@ def load_config_file ( cfile, extraconf=None ): if extraconf is not None: roverlay_config.merge_with ( extraconf ) - roverlay.recipe.easylogger.setup ( roverlay_config ) + if setup_logger: + roverlay.recipe.easylogger.setup ( roverlay_config ) confloader.load_field_definition ( roverlay_config.get_or_fail ( "DESCRIPTION.field_definition_file" ) diff --git a/tests/base.py b/tests/base.py index a9d3f84..2d52079 100644 --- a/tests/base.py +++ b/tests/base.py @@ -20,7 +20,9 @@ class BasicRoverlayTestCase ( unittest.TestCase ): # does nothing if already initialized if cls.CONFIG is None: roverlay.setup_initial_logger() - cls.CONFIG = roverlay.load_config_file ( cls.CONFIG_FILE ) + cls.CONFIG = roverlay.load_config_file ( + cls.CONFIG_FILE, setup_logger=False + ) # --- end of load_config (...) --- # @classmethod |