Bug 968321 - Make manifestparser keep track of DEFAULTS in manifests with no tests. r=jmaher

This commit is contained in:
Ted Mielczarek 2014-02-06 13:22:35 -05:00
parent 9645366154
commit 1588549f0f
3 changed files with 14 additions and 1 deletions

View File

@ -400,6 +400,7 @@ class ManifestParser(object):
def __init__(self, manifests=(), defaults=None, strict=True):
self._defaults = defaults or {}
self.tests = []
self.manifest_defaults = {}
self.strict = strict
self.rootdir = None
self.relativeRoot = None
@ -433,6 +434,7 @@ class ManifestParser(object):
# read the configuration
sections = read_ini(fp=fp, variables=defaults, strict=self.strict)
self.manifest_defaults[filename] = defaults
# get the tests
for section, data in sections:
@ -514,7 +516,6 @@ class ManifestParser(object):
# process each file
for filename in filenames:
# set the per file defaults
defaults = _defaults.copy()
here = None

View File

@ -0,0 +1,2 @@
[DEFAULT]
foo = bar

View File

@ -190,5 +190,15 @@ class TestManifestParser(unittest.TestCase):
missing = manifest.verifyDirectory(directory, extensions=('.js',))
self.assertEqual(missing, (set([missing_test]), set()))
def test_just_defaults(self):
"""Ensure a manifest with just a DEFAULT section exposes that data."""
parser = ManifestParser()
manifest = os.path.join(here, 'just-defaults.ini')
parser.read(manifest)
self.assertEqual(len(parser.tests), 0)
self.assertTrue(manifest in parser.manifest_defaults)
self.assertEquals(parser.manifest_defaults[manifest]['foo'], 'bar')
if __name__ == '__main__':
unittest.main()