mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 1053140 part 2 - Add a test for exported variable override. r=gps
This commit is contained in:
parent
a165981551
commit
3baab7344b
@ -3,3 +3,5 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
XPIDL_MODULE = 'baz'
|
||||
|
@ -242,7 +242,7 @@ class TestBuildReader(unittest.TestCase):
|
||||
self.assertEqual([sandbox['RELATIVEDIR'] for sandbox in sandboxes],
|
||||
['', 'foo', 'foo/baz', 'bar'])
|
||||
self.assertEqual([sandbox['XPIDL_MODULE'] for sandbox in sandboxes],
|
||||
['foobar', 'foobar', 'foobar', 'foobar'])
|
||||
['foobar', 'foobar', 'baz', 'foobar'])
|
||||
|
||||
def test_process_eval_callback(self):
|
||||
def strip_dirs(sandbox):
|
||||
|
@ -180,6 +180,28 @@ class TestSandbox(unittest.TestCase):
|
||||
self.assertEqual(e.args[1], 'reassign')
|
||||
self.assertEqual(e.args[2], 'DIRS')
|
||||
|
||||
def test_exec_source_reassign_exported(self):
|
||||
config = MockConfig()
|
||||
|
||||
exports = {'DIST_SUBDIR': 'browser'}
|
||||
|
||||
sandbox = MozbuildSandbox(config, '', metadata={'exports': exports})
|
||||
|
||||
self.assertEqual(sandbox['DIST_SUBDIR'], 'browser')
|
||||
|
||||
sandbox.exec_source('DIST_SUBDIR = "foo"', 'foo.py')
|
||||
with self.assertRaises(SandboxExecutionError) as se:
|
||||
sandbox.exec_source('DIST_SUBDIR = "bar"', 'foo.py')
|
||||
|
||||
self.assertEqual(sandbox['DIST_SUBDIR'], 'foo')
|
||||
e = se.exception
|
||||
self.assertIsInstance(e.exc_value, KeyError)
|
||||
|
||||
e = se.exception.exc_value
|
||||
self.assertEqual(e.args[0], 'global_ns')
|
||||
self.assertEqual(e.args[1], 'reassign')
|
||||
self.assertEqual(e.args[2], 'DIST_SUBDIR')
|
||||
|
||||
def test_add_tier_dir_regular_str(self):
|
||||
sandbox = self.sandbox()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user