mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-22 08:56:17 +00:00
parent
1605fcd202
commit
8674965c03
@ -10,9 +10,9 @@
|
||||
# Distributed under terms of the GNU AGPLv3 license.
|
||||
|
||||
try:
|
||||
from configparser import ConfigParser
|
||||
from configparser import RawConfigParser
|
||||
except ImportError:
|
||||
from ConfigParser import SafeConfigParser as ConfigParser
|
||||
from ConfigParser import RawConfigParser
|
||||
|
||||
import os
|
||||
import tempfile
|
||||
@ -55,7 +55,7 @@ class IniConfig(DefaultConfig):
|
||||
]
|
||||
|
||||
def __init__(self, paths):
|
||||
parser = ConfigParser()
|
||||
parser = RawConfigParser()
|
||||
parser.read(paths)
|
||||
|
||||
for section in parser.sections():
|
||||
|
@ -11,3 +11,7 @@ switch_true = on
|
||||
yn_false = no
|
||||
yn_true = yes
|
||||
|
||||
[issue84]
|
||||
variable = value
|
||||
key = some value with a %variable
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
# This file is part of Supysonic.
|
||||
# Supysonic is a Python implementation of the Subsonic server API.
|
||||
#
|
||||
# Copyright (C) 2017 Alban 'spl0k' Féron
|
||||
# Copyright (C) 2017-2018 Alban 'spl0k' Féron
|
||||
#
|
||||
# Distributed under terms of the GNU AGPLv3 license.
|
||||
|
||||
@ -32,6 +32,12 @@ class ConfigTestCase(unittest.TestCase):
|
||||
self.assertFalse(conf.BOOLEANS[t + '_false'])
|
||||
self.assertTrue(conf.BOOLEANS[t + '_true'])
|
||||
|
||||
def test_no_interpolation(self):
|
||||
conf = IniConfig('tests/assets/sample.ini')
|
||||
|
||||
self.assertEqual(conf.ISSUE84['variable'], 'value')
|
||||
self.assertEqual(conf.ISSUE84['key'], 'some value with a %variable')
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user