示例#1
0
    def test_large_amounts_of_stderr(self):
        mr_job = MRVerboseJob(['--no-conf', '-r', 'local', '-v'])
        mr_job.sandbox()

        try:
            with no_handlers_for_logger():
                mr_job.run_job()
        except TimeoutException:
            raise
        except SystemExit:
            # we expect the job to throw a StepFailedException,
            # which causes run_job to call sys.exit()

            # look for expected output from MRVerboseJob
            stderr = mr_job.stderr.getvalue()
            self.assertIn(
                b"Counters: 1\n\tFoo\n\t\tBar=10000", stderr)
            self.assertIn(b'Status: 0\n', stderr)
            self.assertIn(b'Status: 99\n', stderr)
            self.assertNotIn(b'Status: 100\n', stderr)
            self.assertIn(b'STDERR: Qux\n', stderr)
            # exception should appear in exception message
            self.assertIn(b'BOOM', stderr)
        else:
            raise AssertionError()
示例#2
0
文件: local_test.py 项目: chomp/mrjob
    def test_large_amounts_of_stderr(self):
        mr_job = MRVerboseJob(['--no-conf'])
        mr_job.sandbox()

        try:
            mr_job.run_job()
        except TimeoutException:
            raise
        except Exception, e:
            # we expect the job to throw an exception

            # look for expected output from MRVerboseJob
            stderr = mr_job.stderr.getvalue()
            assert_in("counters: {'Foo': {'Bar': 10000}}\n", stderr)
            assert_in('status: 0\n', stderr)
            assert_in('status: 99\n', stderr)
            assert_not_in('status: 100\n', stderr)
            assert_in('STDERR: Qux\n', stderr)
            # exception should appear in exception message
            assert_in('BOOM', e.message)
示例#3
0
    def test_large_amounts_of_stderr(self):
        mr_job = MRVerboseJob(['--no-conf'])
        mr_job.sandbox()

        try:
            with no_handlers_for_logger():
                mr_job.run_job()
        except TimeoutException:
            raise
        except Exception, e:
            # we expect the job to throw an exception

            # look for expected output from MRVerboseJob
            stderr = mr_job.stderr.getvalue()
            assert_in("Counters from step 1:\n  Foo:\n    Bar: 10000", stderr)
            assert_in('status: 0\n', stderr)
            assert_in('status: 99\n', stderr)
            assert_not_in('status: 100\n', stderr)
            assert_in('STDERR: Qux\n', stderr)
            # exception should appear in exception message
            assert_in('BOOM', repr(e))
示例#4
0
    def test_large_amounts_of_stderr(self):
        mr_job = MRVerboseJob(["--no-conf", "-r", "local"])
        mr_job.sandbox()

        try:
            with no_handlers_for_logger():
                mr_job.run_job()
        except TimeoutException:
            raise
        except Exception as e:
            # we expect the job to throw an exception

            # look for expected output from MRVerboseJob
            stderr = mr_job.stderr.getvalue()
            self.assertIn(b"Counters from step 1:\n  Foo:\n    Bar: 10000", stderr)
            self.assertIn(b"status: 0\n", stderr)
            self.assertIn(b"status: 99\n", stderr)
            self.assertNotIn(b"status: 100\n", stderr)
            self.assertIn(b"STDERR: Qux\n", stderr)
            # exception should appear in exception message
            self.assertIn("BOOM", repr(e))
        else:
            raise AssertionError()
示例#5
0
    def test_large_amounts_of_stderr(self):
        mr_job = MRVerboseJob(['--no-conf'])
        mr_job.sandbox()

        try:
            with no_handlers_for_logger():
                mr_job.run_job()
        except TimeoutException:
            raise
        except Exception, e:
            # we expect the job to throw an exception

            # look for expected output from MRVerboseJob
            stderr = mr_job.stderr.getvalue()
            assert_in("Counters from step 1:\n  Foo:\n    Bar: 10000", stderr)
            assert_in('status: 0\n', stderr)
            assert_in('status: 99\n', stderr)
            assert_not_in('status: 100\n', stderr)
            assert_in('STDERR: Qux\n', stderr)
            # exception should appear in exception message
            assert_in('BOOM', repr(e))
示例#6
0
    def test_large_amounts_of_stderr(self):
        mr_job = MRVerboseJob(['--no-conf', '-r', 'local', '-v'])
        mr_job.sandbox()

        try:
            with no_handlers_for_logger():
                mr_job.run_job()
        except TimeoutException:
            raise
        except SystemExit:
            # we expect the job to throw a StepFailedException,
            # which causes run_job to call sys.exit()

            # look for expected output from MRVerboseJob
            stderr = mr_job.stderr.getvalue()
            self.assertIn(b"Counters: 1\n\tFoo\n\t\tBar=10000", stderr)
            self.assertIn(b'Status: 0\n', stderr)
            self.assertIn(b'Status: 99\n', stderr)
            self.assertNotIn(b'Status: 100\n', stderr)
            self.assertIn(b'STDERR: Qux\n', stderr)
            # exception should appear in exception message
            self.assertIn(b'BOOM', stderr)
        else:
            raise AssertionError()
示例#7
0
    def test_large_amounts_of_stderr(self):
        mr_job = MRVerboseJob(['--no-conf', '-r', 'local'])
        mr_job.sandbox()

        try:
            with no_handlers_for_logger():
                mr_job.run_job()
        except TimeoutException:
            raise
        except Exception as e:
            # we expect the job to throw an exception

            # look for expected output from MRVerboseJob
            stderr = mr_job.stderr.getvalue()
            self.assertIn(b"Counters from step 1:\n\tFoo\n\t\tBar=10000",
                          stderr)
            self.assertIn(b'status: 0\n', stderr)
            self.assertIn(b'status: 99\n', stderr)
            self.assertNotIn(b'status: 100\n', stderr)
            self.assertIn(b'STDERR: Qux\n', stderr)
            # exception should appear in exception message
            self.assertIn('BOOM', repr(e))
        else:
            raise AssertionError()