Beispiel #1
0
 def test_big_result_works(self):
     result = http.post_json(global_settings.testing.query,
                             data={
                                 "from": "unittest",
                                 "where": {
                                     "and": [{
                                         "gte": {
                                             "run.timestamp":
                                             Date.today() - DAY
                                         }
                                     }, {
                                         "lt": {
                                             "run.timestamp": Date.today()
                                         }
                                     }, {
                                         "eq": {
                                             "result.ok": False
                                         }
                                     }]
                                 },
                                 "format": "list",
                                 "limit": 10000
                             })
     if result.template:
         result = Except.new_instance(result)
         Log.error("problem with call", cause=result)
     Log.note("Got {{num}} test failures", num=len(result.data))
Beispiel #2
0
def error(response):
    response = utf82unicode(response.content)

    try:
        e = Except.new_instance(json2value(response))
    except Exception:
        e = None

    if e:
        Log.error("Failed request", e)
    else:
        Log.error("Failed request\n {{response}}", {"response": response})
Beispiel #3
0
 def _execute(self, command):
     with self.lock:
         if self.current_task is not None:
             self.current_task.wait()
         self.current_task = Signal()
         self.current_response = None
         self.current_error = None
     self.process.stdin.add(value2json(command))
     self.current_task.wait()
     with self.lock:
         try:
             if self.current_error:
                 Log.error("problem with process call", cause=Except.new_instance(self.current_error))
             else:
                 return self.current_response
         finally:
             self.current_task = None
             self.current_response = None
             self.current_error = None
    def _execute(self, command):
        with self.lock:
            self.current_task.wait()
            self.current_task = Signal()
            self.current_response = None
            self.current_error = None

            if self.process.service_stopped:
                Log.error("python is not running")
            self.process.stdin.add(value2json(command))
            (self.current_task | self.process.service_stopped).wait()

            try:
                if self.current_error:
                    Log.error("problem with process call",
                              cause=Except.new_instance(self.current_error))
                else:
                    return self.current_response
            finally:
                self.current_task = DONE
                self.current_response = None
                self.current_error = None