diff --git a/test/unit/common/test_utils.py b/test/unit/common/test_utils.py index e876690b1f..11f0fa5bcf 100644 --- a/test/unit/common/test_utils.py +++ b/test/unit/common/test_utils.py @@ -252,26 +252,29 @@ class TestUtils(unittest.TestCase): foo = bar [section2] -log_name = yarr - ''' - result = utils.readconf(StringIO(conf)) +log_name = yarr''' + f = open('/tmp/test', 'wb') + f.write(conf) + f.close() + result = utils.readconf('/tmp/test') expected = {'section1': {'foo': 'bar'}, 'section2': {'log_name': 'yarr'}} self.assertEquals(result, expected) - result = utils.readconf(StringIO(conf), 'section1') + result = utils.readconf('/tmp/test', 'section1') expected = {'foo': 'bar'} self.assertEquals(result, expected) - result = utils.readconf(StringIO(conf), 'section2').get('log_name') + result = utils.readconf('/tmp/test', 'section2').get('log_name') expected = 'yarr' self.assertEquals(result, expected) - result = utils.readconf(StringIO(conf), 'section1').get('log_name') + result = utils.readconf('/tmp/test', 'section1').get('log_name') expected = 'section1' self.assertEquals(result, expected) - result = utils.readconf(StringIO(conf), 'section1', log_name='foo').get('log_name') + result = utils.readconf('/tmp/test', 'section1', log_name='foo').get('log_name') expected = 'foo' self.assertEquals(result, expected) - result = utils.readconf(StringIO(conf), 'section1', defaults={'bar': 'baz'}) + result = utils.readconf('/tmp/test', 'section1', defaults={'bar': 'baz'}) expected = {'foo': 'bar', 'bar': 'baz'} self.assertEquals(result, expected) + os.unlink('/tmp/test') if __name__ == '__main__': unittest.main()