testing/mozbase/mozrunner/tests/test_stop.py
author B2G Bumper Bot <release+b2gbumper@mozilla.com>
Mon, 17 Nov 2014 03:16:00 -0800
changeset 216081 c258debff3dab0196b2f442ff125f17a7ede9c3d
parent 192633 9579d613f56a9bb3bd34cd9b6145df0fce005e5e
child 323747 55405892e588fa851979d8ea31a656853666b40f
permissions -rw-r--r--
Bumping gaia.json for 6 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/82204d99a4c4 Author: Dominic Kuo <dkuo@mozilla.com> Desc: Merge pull request #26146 from dominickuo/bug-1082938 Bug 1082938 - [Music] set play status to playing when play event fires, r=jimporter ======== https://hg.mozilla.org/integration/gaia-central/rev/958e4dddc74f Author: Dominic Kuo <dkuo@mozilla.com> Desc: Bug 1082938 - [Music] set play status to playing when play event fires ======== https://hg.mozilla.org/integration/gaia-central/rev/0ebefae658f4 Author: RickyChien <RickyChien@users.noreply.github.com> Desc: Merge pull request #26188 from RickyChien/bug-1022728 Bug 1022728 - Prevent building gaia when running ./build.sh gecko r=@cctuan ======== https://hg.mozilla.org/integration/gaia-central/rev/366a14e421f4 Author: Ricky Chien <ricky060709@gmail.com> Desc: Bug 1022728 - Prevent building gaia when running ./build.sh gecko ======== https://hg.mozilla.org/integration/gaia-central/rev/f386379f0d8d Author: Etienne Segonzac <etienne@segonzac.info> Desc: Merge pull request #25938 from etiennesegonzac/bug-1088166 Bug 1088166 - Adding sanity marionette JS tests for the TaskManager r=sfoster ======== https://hg.mozilla.org/integration/gaia-central/rev/082e9a35b762 Author: Etienne Segonzac <etienne@segonzac.info> Desc: Bug 1088166 - Adding sanity marionette JS tests for the TaskManager

#!/usr/bin/env python
# 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/.

import signal

import mozrunnertest


class MozrunnerStopTestCase(mozrunnertest.MozrunnerTestCase):

    def test_stop_process(self):
        """Stop the process and test properties"""
        self.runner.start()
        returncode = self.runner.stop()

        self.assertFalse(self.runner.is_running())
        self.assertNotIn(returncode, [None, 0])
        self.assertEqual(self.runner.returncode, returncode)
        self.assertIsNotNone(self.runner.process_handler)

        self.assertEqual(self.runner.wait(1), returncode)

    def test_stop_before_start(self):
        """Stop the process before it gets started should not raise an error"""
        self.runner.stop()

    def test_stop_process_custom_signal(self):
        """Stop the process via a custom signal and test properties"""
        self.runner.start()
        returncode = self.runner.stop(signal.SIGTERM)

        self.assertFalse(self.runner.is_running())
        self.assertNotIn(returncode, [None, 0])
        self.assertEqual(self.runner.returncode, returncode)
        self.assertIsNotNone(self.runner.process_handler)

        self.assertEqual(self.runner.wait(1), returncode)