BF: In line comments need to specifically enabled in python3.2+

pull/491/head
Steven Hiscocks 2013-12-13 21:11:45 +00:00
parent 1df634b68b
commit bff170ec43
2 changed files with 13 additions and 0 deletions

View File

@ -100,6 +100,7 @@ after = 1.conf
def __init__(self, *args, **kwargs):
kwargs = kwargs.copy()
kwargs['interpolation'] = BasicInterpolationWithName()
kwargs['inline_comment_prefixes'] = ";"
super(SafeConfigParserWithIncludes, self).__init__(
*args, **kwargs)

View File

@ -131,6 +131,18 @@ z = 3%(__name__)s
self.assertEqual(self.c.get('section', 'zz'), 'thesection') # __name__ works even 'delayed'
self.assertEqual(self.c.get('section2', 'z'), '3section2') # and differs per section ;)
def testComments(self):
self.assertFalse(self.c.read('g')) # nothing is there yet
self._write("g.conf", value=None, content="""
[DEFAULT]
# A comment
b = a
c = d ;in line comment
""")
self.assertTrue(self.c.read('g'))
self.assertEqual(self.c.get('DEFAULT', 'b'), 'a')
self.assertEqual(self.c.get('DEFAULT', 'c'), 'd')
class JailReaderTest(unittest.TestCase):
def testIncorrectJail(self):