testing/mozbase/mozrunner/tests/test_start.py

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 #!/usr/bin/env python
     3 import os
     4 from time import sleep
     5 import unittest
     7 import mozrunnertest
    10 class MozrunnerStartTestCase(mozrunnertest.MozrunnerTestCase):
    12     def test_start_process(self):
    13         """Start the process and test properties"""
    14         self.assertIsNone(self.runner.process_handler)
    16         self.runner.start()
    18         self.assertTrue(self.runner.is_running())
    19         self.assertIsNotNone(self.runner.process_handler)
    21     def test_start_process_called_twice(self):
    22         """Start the process twice and test that first process is gone"""
    23         pid1 = self.runner.start()
    24         # Bug 925480
    25         # Make a copy until mozprocess can kill a specific process
    26         process_handler = self.runner.process_handler
    28         pid2 = self.runner.start()
    30         try:
    31             self.assertNotIn(process_handler.wait(1), [None, 0])
    32         finally:
    33             process_handler.kill()
    35     def test_start_with_timeout(self):
    36         """Start the process and set a timeout"""
    37         self.runner.start(timeout=2)
    38         sleep(5)
    40         self.assertFalse(self.runner.is_running())
    42     def test_start_with_outputTimeout(self):
    43         """Start the process and set a timeout"""
    44         self.runner.start(outputTimeout=2)
    45         sleep(5)
    47         self.assertFalse(self.runner.is_running())

mercurial