Commit 8915716c authored by Trevor Cappallo's avatar Trevor Cappallo
Browse files

fix load config, add unit test

parent 2bc81d8e
......@@ -219,7 +219,7 @@ def setup(config_file=None, logger_name=None, log_filename=None, log_root_dir=No
with open(config_file, 'r') as f:
loaded_config = json.load(f)
for key, val in loaded_config.items():
if key in config and config[val] is None:
if key in config and config[key] is None:
logging.debug("- setting option from file: %s --> %s", key, val)
config[key] = val
# Set reasonable defaults for remaining Nones.
......
#!/usr/bin/env python
"""Unit tests for OperationalLogging."""
import unittest
from nose.tools import raises, eq_
import tempfile
import os
import os.path
import logging
import shutil
import atexit
import StringIO
import OperationalLogger as OpLog
import OperationalMail as OpMail
class TestAll(unittest.TestCase):
def setUp(self):
print '\n\n'
self.temp_dir = tempfile.mkdtemp()
self.log_dir = tempfile.mkdtemp()
OpLog.setup(config_file="test-config.json", log_root_dir=self.log_dir)
def tearDown(self):
shutil.rmtree(self.temp_dir)
shutil.rmtree(self.log_dir)
print '\n\n'
def test_config_file(self):
logging.info("This is an info.")
if __name__ == '__main__':
unittest.main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment