Bug 1254374 - Remove the old TestConfigure.test_imports test. r?nalexander
It now duplicates the test added in
bug 1256573, which is actually better.
--- a/python/mozbuild/mozbuild/test/configure/data/moz.configure
+++ b/python/mozbuild/mozbuild/test/configure/data/moz.configure
@@ -142,32 +142,16 @@ def include_path(path, help):
include(include_path)
# Sandboxed functions can import from modules through the use of the @imports
# decorator.
# The order of the decorators matter: @imports needs to appear after other
# decorators.
option('--with-imports', nargs='?', help='Imports')
-@depends('--with-imports')
-@imports(_from='mozbuild.configure.options', _import='OptionValue')
-def with_imports(value):
- if value:
- return isinstance(value, OptionValue)
-
-set_config('IMPORTS', with_imports)
-
-# Trying to import manually will fail at runtime.
-@depends('--with-imports')
-def with_imports(value):
- if len(value) and value[0] == 'break':
- from mozbuild.configure.options import OptionValue
- return isinstance(value, OptionValue)
-
-set_config('IMPORTS2', with_imports)
# A limited set of functions from os.path are exposed by default.
@depends('--with-imports')
def with_imports(value):
if len(value):
return os.path.isfile(value[0])
set_config('IS_FILE', with_imports)
--- a/python/mozbuild/mozbuild/test/configure/test_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_configure.py
@@ -223,24 +223,16 @@ class TestConfigure(unittest.TestCase):
config = self.get_config(env={'CC': 'gcc'})
self.assertIn('CFLAGS', config)
self.assertEquals(config['CFLAGS'], ['-Werror=foobar'])
config = self.get_config(env={'CC': 'clang'})
self.assertNotIn('CFLAGS', config)
def test_imports(self):
- config = self.get_config(['--with-imports'])
- self.assertIn('IMPORTS', config)
- self.assertEquals(config['IMPORTS'], True)
-
- with self.assertRaises(ImportError):
- self.get_config(['--with-imports=break'])
-
- def test_imports(self):
config = {}
out = StringIO()
sandbox = ConfigureSandbox(config, {}, [], out, out)
with self.assertRaises(ImportError):
exec(textwrap.dedent('''
@template
def foo():