Bug 1467462 - Adjust test_developer_options after bug 1467041. r=froydnj, a=RyanVM
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 08 Jun 2018 07:11:42 +0900
changeset 473694 05400e59a489907c2efdabb31d747eee56a79905
parent 473693 40c975562211ad6c054de920f857457f224b3502
child 473695 bb10f7335b01da28046b6591cc109c0a4586683f
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj, RyanVM
bugs1467462, 1467041
milestone61.0
Bug 1467462 - Adjust test_developer_options after bug 1467041. r=froydnj, a=RyanVM Bug 1467041 changed the default for --enable-release such that it is affected by the milestone. Test both possible cases for milestones.
python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py
--- a/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py
@@ -3,35 +3,42 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import os
 
 from buildconfig import topsrcdir
 from common import BaseConfigureTest
-from mozunit import main
+from mozunit import MockedOpen, main
 from mozbuild.configure.options import InvalidOptionError
 
 
 class TestToolkitMozConfigure(BaseConfigureTest):
-    def test_developer_options(self):
+    def test_developer_options(self, milestone='42.0a1'):
         def get_value(args=[], environ={}):
             sandbox = self.get_sandbox({}, {}, args, environ)
             return sandbox._value_for(sandbox['developer_options'])
 
-        self.assertEqual(get_value(), True)
+        milestone_path = os.path.join(topsrcdir, 'config', 'milestone.txt')
+        with MockedOpen({milestone_path: milestone}):
+            # developer options are enabled by default on "nightly" milestone
+            # only
+            self.assertEqual(get_value(), 'a' in milestone or None)
 
-        self.assertEqual(get_value(['--enable-release']), None)
+            self.assertEqual(get_value(['--enable-release']), None)
 
-        self.assertEqual(get_value(environ={'MOZILLA_OFFICIAL': 1}), None)
+            self.assertEqual(get_value(environ={'MOZILLA_OFFICIAL': 1}), None)
 
-        self.assertEqual(get_value(['--enable-release'],
-                         environ={'MOZILLA_OFFICIAL': 1}), None)
+            self.assertEqual(get_value(['--enable-release'],
+                             environ={'MOZILLA_OFFICIAL': 1}), None)
 
-        with self.assertRaises(InvalidOptionError):
-            get_value(['--disable-release'], environ={'MOZILLA_OFFICIAL': 1})
+            with self.assertRaises(InvalidOptionError):
+                get_value(['--disable-release'],
+                          environ={'MOZILLA_OFFICIAL': 1})
 
-        self.assertEqual(get_value(environ={'MOZ_AUTOMATION': 1}), None)
+            self.assertEqual(get_value(environ={'MOZ_AUTOMATION': 1}), None)
 
+    def test_developer_options_release(self):
+        self.test_developer_options('42.0')
 
 if __name__ == '__main__':
     main()