author Mike Hommey <>
Fri, 08 Jun 2018 07:11:42 +0900
changeset 473694 05400e59a489907c2efdabb31d747eee56a79905
parent 427990 ce6e2f914c96563ef4d4b2dd2bb10fe1b9fd2a33
child 511770 2c4de7449db2b6fa793d6a0f9919759cb81a3895
permissions -rw-r--r--
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.

# 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

from __future__ import absolute_import, print_function, unicode_literals

import os

from buildconfig import topsrcdir
from common import BaseConfigureTest
from mozunit import MockedOpen, main
from mozbuild.configure.options import InvalidOptionError

class TestToolkitMozConfigure(BaseConfigureTest):
    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'])

        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(environ={'MOZILLA_OFFICIAL': 1}), None)

                             environ={'MOZILLA_OFFICIAL': 1}), None)

            with self.assertRaises(InvalidOptionError):
                          environ={'MOZILLA_OFFICIAL': 1})

            self.assertEqual(get_value(environ={'MOZ_AUTOMATION': 1}), None)

    def test_developer_options_release(self):

if __name__ == '__main__':