def test_run_stdout_stderr_exit(self):
        """Check that we get the expected stdout, stderr and exit code
        """
        stdoutText = "output out o text"
        stderrText = "error err e text"
        exitCode = 42
        pythonScript = ("import sys;"
                        "sys.stdout.write('%s');"
                        "sys.stderr.write('%s');"
                        "exit(%i);"
                        % (stdoutText, stderrText, exitCode))
        command = "%s -c %r" % (PYTHON_COMMAND, pythonScript)

        disconnectedDeferred = defer.Deferred()
        protocol = ProcessProtocol()
        protocol.processEnded = disconnectedDeferred.callback
        resultDeferred = self.inductor.run(command, uid=UID)
        resultDeferred.addErrback(self.fail)
        @resultDeferred.addCallback
        def checkResult((r_stdoutText, r_stderrText, r_exitCode)):
            self.assertEqual(r_stdoutText, stdoutText, "stdout not as expected")
            self.assertEqual(r_stderrText, stderrText, "stderr not as expected")
            self.assertEqual(r_exitCode, exitCode, "unexpected exit code")
        return resultDeferred
dataset/ETHPy150Open sporsh/carnifex/test/integration/test_inductor.py/InductorTestMixin.test_run_stdout_stderr_exit/original