testing/mozbase/mozrunner/tests/test_wait.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/testing/mozbase/mozrunner/tests/test_wait.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,33 @@
     1.4 +#!/usr/bin/env python
     1.5 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.7 +# You can obtain one at http://mozilla.org/MPL/2.0/.
     1.8 +
     1.9 +import os
    1.10 +
    1.11 +import mozrunner
    1.12 +
    1.13 +import mozrunnertest
    1.14 +
    1.15 +
    1.16 +class MozrunnerWaitTestCase(mozrunnertest.MozrunnerTestCase):
    1.17 +
    1.18 +    def test_wait_while_running(self):
    1.19 +        """Wait for the process while it is running"""
    1.20 +        self.runner.start()
    1.21 +        returncode = self.runner.wait(1)
    1.22 +
    1.23 +        self.assertTrue(self.runner.is_running())
    1.24 +        self.assertEqual(returncode, None)
    1.25 +        self.assertEqual(self.runner.returncode, returncode)
    1.26 +        self.assertIsNotNone(self.runner.process_handler)
    1.27 +
    1.28 +    def test_wait_after_process_finished(self):
    1.29 +        """Bug 965714: wait() after stop should not raise an error"""
    1.30 +        self.runner.start()
    1.31 +        self.runner.process_handler.kill()
    1.32 +
    1.33 +        returncode = self.runner.wait(1)
    1.34 +
    1.35 +        self.assertNotIn(returncode, [None, 0])
    1.36 +        self.assertIsNotNone(self.runner.process_handler)

mercurial