зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1603844 - [mochitest] Fix a failure in the 'test_get_active_tests.py' selftest, r=gbrown
Differential Revision: https://phabricator.services.mozilla.com/D58051 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
c1ef537e20
Коммит
a2dc1440c5
|
@ -46,9 +46,9 @@ def create_manifest(tmpdir, build_obj):
|
||||||
|
|
||||||
def inner(string, name='manifest.ini'):
|
def inner(string, name='manifest.ini'):
|
||||||
manifest = tmpdir.join(name)
|
manifest = tmpdir.join(name)
|
||||||
manifest.write(string)
|
manifest.write(string, ensure=True)
|
||||||
path = unicode(manifest)
|
path = unicode(manifest)
|
||||||
return TestManifest(manifests=(path,), strict=False)
|
return TestManifest(manifests=(path,), strict=False, rootdir=tmpdir.strpath)
|
||||||
|
|
||||||
return inner
|
return inner
|
||||||
|
|
||||||
|
@ -79,30 +79,6 @@ def test_prefs_validation(get_active_tests, create_manifest):
|
||||||
assert len(prefs) == 1
|
assert len(prefs) == 1
|
||||||
assert prefs.pop() == "\nfoo=bar\nbrowser.dom.foo=baz"
|
assert prefs.pop() == "\nfoo=bar\nbrowser.dom.foo=baz"
|
||||||
|
|
||||||
# Test prefs set by an ancestor manifest.
|
|
||||||
manifest = create_manifest(dedent("""
|
|
||||||
[DEFAULT]
|
|
||||||
prefs =
|
|
||||||
browser.dom.foo=fleem
|
|
||||||
flower=rose
|
|
||||||
|
|
||||||
[include:manifest.ini]
|
|
||||||
[test_foo.html]
|
|
||||||
"""), name='ancestor-manifest.ini')
|
|
||||||
options['manifestFile'] = manifest
|
|
||||||
md, tests = get_active_tests(**options)
|
|
||||||
assert len(tests) == 3
|
|
||||||
|
|
||||||
assert 'ancestor-manifest.ini' in md.prefs_by_manifest
|
|
||||||
prefs = md.prefs_by_manifest['ancestor-manifest.ini']
|
|
||||||
assert len(prefs) == 1
|
|
||||||
assert prefs.pop() == '\nbrowser.dom.foo=fleem\nflower=rose'
|
|
||||||
|
|
||||||
assert 'ancestor-manifest.ini:manifest.ini' in md.prefs_by_manifest
|
|
||||||
prefs = md.prefs_by_manifest['ancestor-manifest.ini:manifest.ini']
|
|
||||||
assert len(prefs) == 1
|
|
||||||
assert prefs.pop() == '\nbrowser.dom.foo=fleem\nflower=rose \nfoo=bar\nbrowser.dom.foo=baz'
|
|
||||||
|
|
||||||
# Test prefs set with runByManifest disabled.
|
# Test prefs set with runByManifest disabled.
|
||||||
options['runByManifest'] = False
|
options['runByManifest'] = False
|
||||||
with pytest.raises(SystemExit):
|
with pytest.raises(SystemExit):
|
||||||
|
@ -119,5 +95,51 @@ def test_prefs_validation(get_active_tests, create_manifest):
|
||||||
get_active_tests(**options)
|
get_active_tests(**options)
|
||||||
|
|
||||||
|
|
||||||
|
def test_prefs_validation_with_ancestor_manifest(get_active_tests, create_manifest):
|
||||||
|
# Test prefs set by an ancestor manifest.
|
||||||
|
create_manifest(dedent("""
|
||||||
|
[DEFAULT]
|
||||||
|
prefs=
|
||||||
|
foo=bar
|
||||||
|
browser.dom.foo=baz
|
||||||
|
|
||||||
|
[files/test_pass.html]
|
||||||
|
[files/test_fail.html]
|
||||||
|
"""), name='subdir/manifest.ini')
|
||||||
|
|
||||||
|
manifest = create_manifest(dedent("""
|
||||||
|
[DEFAULT]
|
||||||
|
prefs =
|
||||||
|
browser.dom.foo=fleem
|
||||||
|
flower=rose
|
||||||
|
|
||||||
|
[include:manifest.ini]
|
||||||
|
[test_foo.html]
|
||||||
|
"""), name='subdir/ancestor-manifest.ini')
|
||||||
|
|
||||||
|
options = {
|
||||||
|
'runByManifest': True,
|
||||||
|
'manifestFile': manifest,
|
||||||
|
}
|
||||||
|
|
||||||
|
md, tests = get_active_tests(**options)
|
||||||
|
assert len(tests) == 3
|
||||||
|
|
||||||
|
key = os.path.join('subdir', 'ancestor-manifest.ini')
|
||||||
|
assert key in md.prefs_by_manifest
|
||||||
|
prefs = md.prefs_by_manifest[key]
|
||||||
|
assert len(prefs) == 1
|
||||||
|
assert prefs.pop() == '\nbrowser.dom.foo=fleem\nflower=rose'
|
||||||
|
|
||||||
|
key = '{}:{}'.format(
|
||||||
|
os.path.join('subdir', 'ancestor-manifest.ini'),
|
||||||
|
os.path.join('subdir', 'manifest.ini')
|
||||||
|
)
|
||||||
|
assert key in md.prefs_by_manifest
|
||||||
|
prefs = md.prefs_by_manifest[key]
|
||||||
|
assert len(prefs) == 1
|
||||||
|
assert prefs.pop() == '\nbrowser.dom.foo=fleem\nflower=rose \nfoo=bar\nbrowser.dom.foo=baz'
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
mozunit.main()
|
mozunit.main()
|
||||||
|
|
Загрузка…
Ссылка в новой задаче