michael@0: #!/usr/bin/env python michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: # You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: import os michael@0: michael@0: import mozrunner michael@0: michael@0: import mozrunnertest michael@0: michael@0: michael@0: class MozrunnerWaitTestCase(mozrunnertest.MozrunnerTestCase): michael@0: michael@0: def test_wait_while_running(self): michael@0: """Wait for the process while it is running""" michael@0: self.runner.start() michael@0: returncode = self.runner.wait(1) michael@0: michael@0: self.assertTrue(self.runner.is_running()) michael@0: self.assertEqual(returncode, None) michael@0: self.assertEqual(self.runner.returncode, returncode) michael@0: self.assertIsNotNone(self.runner.process_handler) michael@0: michael@0: def test_wait_after_process_finished(self): michael@0: """Bug 965714: wait() after stop should not raise an error""" michael@0: self.runner.start() michael@0: self.runner.process_handler.kill() michael@0: michael@0: returncode = self.runner.wait(1) michael@0: michael@0: self.assertNotIn(returncode, [None, 0]) michael@0: self.assertIsNotNone(self.runner.process_handler)