testing/mozbase/mozrunner/tests/test_stop.py

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 #!/usr/bin/env python
     2 # This Source Code Form is subject to the terms of the Mozilla Public
     3 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
     4 # You can obtain one at http://mozilla.org/MPL/2.0/.
     6 import os
     7 import signal
     9 import mozrunnertest
    12 class MozrunnerStopTestCase(mozrunnertest.MozrunnerTestCase):
    14     def test_stop_process(self):
    15         """Stop the process and test properties"""
    16         self.runner.start()
    17         returncode = self.runner.stop()
    19         self.assertFalse(self.runner.is_running())
    20         self.assertNotIn(returncode, [None, 0])
    21         self.assertEqual(self.runner.returncode, returncode)
    22         self.assertIsNotNone(self.runner.process_handler)
    24         self.assertEqual(self.runner.wait(1), returncode)
    26     def test_stop_before_start(self):
    27         """Stop the process before it gets started should not raise an error"""
    28         returncode = self.runner.stop()
    30     def test_stop_process_custom_signal(self):
    31         """Stop the process via a custom signal and test properties"""
    32         self.runner.start()
    33         returncode = self.runner.stop(signal.SIGTERM)
    35         self.assertFalse(self.runner.is_running())
    36         self.assertNotIn(returncode, [None, 0])
    37         self.assertEqual(self.runner.returncode, returncode)
    38         self.assertIsNotNone(self.runner.process_handler)
    40         self.assertEqual(self.runner.wait(1), returncode)

mercurial