fix: force interpolation of %(here)s
, %(__file__)s
in config files
we were previously doing this only for the `wutta.config.include` and `wutta.config.require` settings, and pyramid (or paste?) has been handling certain other ones, e.g. for beaker session cache paths. but we really need to be able to rely on this being available "everywhere" or else it's just confusing.
This commit is contained in:
parent
659d7e551e
commit
fa76eb6aa9
2 changed files with 35 additions and 14 deletions
|
@ -159,6 +159,17 @@ require = %(here)s/first.conf
|
|||
self.assertEqual(files[0], second)
|
||||
self.assertEqual(files[1], first)
|
||||
|
||||
def test_default_vars_interpolated(self):
|
||||
myconf = self.write_file('my.conf', """
|
||||
[foo]
|
||||
bar = %(here)s/bar.txt
|
||||
baz = %(__file__)s
|
||||
""")
|
||||
|
||||
config = conf.WuttaConfig(files=[myconf])
|
||||
self.assertEqual(config.get('foo.bar'), f'{self.tempdir}/bar.txt')
|
||||
self.assertEqual(config.get('foo.baz'), myconf)
|
||||
|
||||
def test_constructor_defaults(self):
|
||||
config = conf.WuttaConfig()
|
||||
self.assertEqual(config.defaults, {})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue