[ARVADOS] updated: 0ef1d324c964f0bbf677e533326b36369ea9e44e

git at public.curoverse.com git at public.curoverse.com
Wed Oct 7 15:25:46 EDT 2015


Summary of changes:
 sdk/python/arvados/__init__.py             |  2 +-
 sdk/python/tests/test_task_output_retry.py | 20 +++++++++++++-------
 2 files changed, 14 insertions(+), 8 deletions(-)

       via  0ef1d324c964f0bbf677e533326b36369ea9e44e (commit)
      from  ce00b3ce9b3360d0f21c400622536dbcabbc719a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 0ef1d324c964f0bbf677e533326b36369ea9e44e
Author: Bryan Cosca <bcosc at curoverse.com>
Date:   Wed Oct 7 15:25:40 2015 -0400

    6600: flailing TypeError bytes

diff --git a/sdk/python/arvados/__init__.py b/sdk/python/arvados/__init__.py
index fbf88b6..a319382 100644
--- a/sdk/python/arvados/__init__.py
+++ b/sdk/python/arvados/__init__.py
@@ -46,7 +46,7 @@ def task_set_output(self,s,api_client=None,num_retries=5):
     for tries_left in RetryLoop(num_retries=num_retries, backoff_start=0): # change this to 2 after tests are finished
         try:
             print "we tried"
-            return api_client.job_tasks().update(uuid=self['uuid'],
+            api_client.job_tasks().update(uuid=self['uuid'],
                                                  body={
                                                       'output':s,
                                                       'success':True,
diff --git a/sdk/python/tests/test_task_output_retry.py b/sdk/python/tests/test_task_output_retry.py
index 31c5462..4d738cf 100644
--- a/sdk/python/tests/test_task_output_retry.py
+++ b/sdk/python/tests/test_task_output_retry.py
@@ -5,11 +5,15 @@ import os
 import unittest
 import hashlib
 import run_test_server
-
+import mimetypes
+import json
 import arvados
 import arvados_testutil as tutil
 from apiclient import http as apiclient_http
 
+if not mimetypes.inited:
+    mimetypes.init()
+
 class ApiClientRetrytestMixin(object):
 
     TEST_UUID = 'zzzzz-zzzzz-zzzzzzzzzzzzzzz'
@@ -19,7 +23,7 @@ class ApiClientRetrytestMixin(object):
     def setUpClass(cls):
         run_test_server.run()
         mock_responses = {
-            'arvados.job_tasks().update().execute': (tutil.fake_httplib2_response(500), "")
+            'arvados.job_tasks().update().execute': (tutil.fake_httplib2_response(500, **cls.ERROR_HEADERS), "")
         }
         req_builder = apiclient_http.RequestMockBuilder(mock_responses)
         cls.api = arvados.api('v1',
@@ -45,8 +49,8 @@ class ApiClientRetrytestMixin(object):
     def check_exception(self, error_class=None, api_client=None, *args, **kwargs):
         if error_class is None:
             error_class = self.DEFAULT_EXCEPTION
-        print error_class.failureException
-        self.run_method(api_client=api_client)
+        #print error_class.failureException
+        #self.run_method(api_client=api_client)
         self.assertRaises(error_class, self.run_method(api_client=api_client), *args, **kwargs)
 
 #    def test_immediate_success(self):
@@ -57,13 +61,14 @@ class ApiClientRetrytestMixin(object):
         api_client = mock.MagicMock()
 #        with self.TEST_API_PATCHER(self.DEFAULT_EXPECT, 400), tutil.skip_sleep, \
 #                            self.assertRaises(arvados.errors.HttpError) as err_check:
-        with tutil.mock_responses(api_client.job_tasks().update().execute, 500) as req_mock:
+        with tutil.mock_responses(api_client.job_tasks().update().execute, 400) as req_mock:
             print dir(req_mock)
             print req_mock
             #api_client.job_tasks().update().execute.side_effect = arvados.errors.HttpError(400, "{}")
             #self.check_exception(api_client=api_client)
             #print dir(err_check)
-            self.run_method(api_client=api_client)
+            self.check_exception()
+            #self.run_method(api_client=api_client)
             #print err_check.failureException
             #self.assertEqual(400, err_check.exception.request_errors())
             #self.assertRaises(error_class, self.run_method(api_client=api_client), *args, **kwargs)
@@ -87,7 +92,8 @@ class ApiClientRetrytestMixin(object):
 #            self.check_success()
 
 class TaskSetOutputTestCase(ApiClientRetrytestMixin, unittest.TestCase):
-    
+
+    ERROR_HEADERS = {'Content-Type': mimetypes.types_map['.json']}
     DEFAULT_EXPECT = None
     DEFAULT_RETURN = True
     DEFAULT_EXCEPTION = arvados.errors.HttpError

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list