Bug 1254374 - Remove the old TestConfigure.test_imports test. r?nalexander draft
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 12 Apr 2016 15:00:40 +0900
changeset 349790 2fa9891a56e2e3fc9684e2225c6cb56fa1344a8a
parent 349773 85a28619dd12113740470b2a3b6178ddc5c1c1bd
child 349791 2c9fc838c1b991a8af81ffa710becc4570ef43b8
push id15177
push userbmo:mh+mozilla@glandium.org
push dateTue, 12 Apr 2016 09:20:20 +0000
reviewersnalexander
bugs1254374, 1256573
milestone48.0a1
Bug 1254374 - Remove the old TestConfigure.test_imports test. r?nalexander It now duplicates the test added in bug 1256573, which is actually better.
python/mozbuild/mozbuild/test/configure/data/moz.configure
python/mozbuild/mozbuild/test/configure/test_configure.py
--- 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():