зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1365477 - Ensure all callers of CommandLineHandler() pass a complete argv. r=chmanchester
CommandLineHandler() expects argv to be like sys.argv, containing the command name in argv[0], but various tests weren't doing that, in some cases even leading to ignored arguments passed as argv[0]. In turn, that made lint.py only test browser/moz.configure instead of all the project moz.configures as intended. --HG-- extra : rebase_source : 8a87216edaa4a2fd27abb9ef74d38a254a2bbeed
This commit is contained in:
Родитель
a79246698a
Коммит
ef3f9aa89b
|
@ -397,6 +397,7 @@ class CommandLineHelper(object):
|
|||
self._origins = {}
|
||||
self._last = 0
|
||||
|
||||
assert(argv and not argv[0].startswith('--'))
|
||||
for arg in argv[1:]:
|
||||
self.add(arg, 'command-line', self._args)
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class Lint(unittest.TestCase):
|
|||
'OLD_CONFIGURE': os.path.join(topsrcdir, 'old-configure'),
|
||||
'MOZCONFIG': os.path.join(os.path.dirname(test_path), 'data',
|
||||
'empty_mozconfig'),
|
||||
}, ['--enable-project=%s' % project, '--help'])
|
||||
}, ['configure', '--enable-project=%s' % project, '--help'])
|
||||
sandbox.run(os.path.join(topsrcdir, 'moz.configure'))
|
||||
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ class TestConfigure(unittest.TestCase):
|
|||
def test_imports(self):
|
||||
config = {}
|
||||
out = StringIO()
|
||||
sandbox = ConfigureSandbox(config, {}, [], out, out)
|
||||
sandbox = ConfigureSandbox(config, {}, ['configure'], out, out)
|
||||
|
||||
with self.assertRaises(ImportError):
|
||||
exec_(textwrap.dedent('''
|
||||
|
@ -368,7 +368,7 @@ class TestConfigure(unittest.TestCase):
|
|||
|
||||
config = {}
|
||||
out = StringIO()
|
||||
sandbox = CountApplyImportsSandbox(config, {}, [], out, out)
|
||||
sandbox = CountApplyImportsSandbox(config, {}, ['configure'], out, out)
|
||||
|
||||
exec_(textwrap.dedent('''
|
||||
@template
|
||||
|
@ -406,7 +406,7 @@ class TestConfigure(unittest.TestCase):
|
|||
def test_decorators(self):
|
||||
config = {}
|
||||
out = StringIO()
|
||||
sandbox = ConfigureSandbox(config, {}, [], out, out)
|
||||
sandbox = ConfigureSandbox(config, {}, ['configure'], out, out)
|
||||
|
||||
sandbox.include_file(mozpath.join(test_data_path, 'decorators.configure'))
|
||||
|
||||
|
|
|
@ -665,6 +665,9 @@ class TestCommandLineHelper(unittest.TestCase):
|
|||
self.assertEquals(NegativeOptionValue(), value)
|
||||
self.assertEquals(None, option)
|
||||
|
||||
with self.assertRaises(AssertionError):
|
||||
CommandLineHelper({}, ['--foo', '--bar'])
|
||||
|
||||
def test_precedence(self):
|
||||
foo = Option('--with-foo', nargs='*')
|
||||
helper = CommandLineHelper({}, ['cmd', '--with-foo=a,b'])
|
||||
|
|
|
@ -421,7 +421,7 @@ class TestLogSubprocessOutput(unittest.TestCase):
|
|||
|
||||
def test_non_ascii_subprocess_output(self):
|
||||
out = StringIO()
|
||||
sandbox = ConfigureSandbox({}, {}, [], out, out)
|
||||
sandbox = ConfigureSandbox({}, {}, ['configure'], out, out)
|
||||
|
||||
sandbox.include_file(mozpath.join(topsrcdir, 'build',
|
||||
'moz.configure', 'util.configure'))
|
||||
|
|
Загрузка…
Ссылка в новой задаче