def map_column(self, value): """ Applied to each column of every row returned by `rows`. Default behaviour is to escape special characters and identify any self.null_values. """ if value in self.null_values: return r'\\N' else: return default_escape(six.text_type(value))
def test_handle_failed_job(self, proc, file): proc.return_value.returncode = 1 file.return_value = BytesIO(b"stderr") try: job = TestSparkSubmitTask() job.run() except SparkJobError as e: self.assertEqual(e.err, "stderr") self.assertTrue("STDERR: stderr" in six.text_type(e)) else: self.fail("Should have thrown SparkJobError")
def test_handle_failed_job(self, proc, file): proc.return_value.returncode = 1 file.return_value = BytesIO(b'stderr') try: job = TestExternalProgramTask() job.run() except ExternalProgramRunError as e: self.assertEqual(e.err, 'stderr') self.assertIn('STDERR: stderr', six.text_type(e)) else: self.fail('Should have thrown SubprocessRunError')
def test_handle_failed_job(self, proc, file): proc.return_value.returncode = 1 file.return_value = BytesIO(b'stderr') try: job = TestSparkSubmitTask() job.run() except SparkJobError as e: self.assertEqual(e.err, 'stderr') self.assertTrue('STDERR: stderr' in six.text_type(e)) else: self.fail("Should have thrown SparkJobError")
def test_handle_failed_job(self, proc, file): proc.return_value.returncode = 1 file.return_value = BytesIO(b"stderr") try: job = TestExternalProgramTask() job.run() except ExternalProgramRunError as e: self.assertEqual(e.err, "stderr") self.assertIn("STDERR: stderr", six.text_type(e)) else: self.fail("Should have thrown SubprocessRunError")
def test_handle_failed_job(self, proc, file, logger): proc.return_value.returncode = 1 file.return_value = BytesIO(b'stderr') try: job = TestExternalProgramTask() job.run() except ExternalProgramRunError as e: self.assertEqual(e.err, 'stderr') self.assertIn('STDERR: stderr', six.text_type(e)) self.assertIn(call.info('Program stderr:\nstderr'), logger.mock_calls) else: self.fail('Should have thrown ExternalProgramRunError')