Пример #1
0
    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))
Пример #2
0
    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))
Пример #3
0
 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")
Пример #4
0
 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')
Пример #5
0
 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")
Пример #6
0
 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")
Пример #7
0
 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')
Пример #8
0
 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')