def derive_test_results_key() : from testing_runtime import tests_config _test = get_test() _task = get_task() if _task == None : return "GANY_TEST_RESULT_LOG" return "GANY_TEST_RESULT_" + str(_task.task_id) + "_" + str( tests_config.test_to_id( _test ) )
def __enter__(self): global _test self._old_test = _test _test = self._test if self._update_current_test_value : from testing_runtime import tests_config self._old_current = memcached.get( derive_current_test_key(), "0" ) memcached.set( derive_current_test_key(), tests_config.test_to_id( _test ) )
def get_result() : global _test obj = json.loads( memcached.get( derive_test_results_key(), u"{}" ) ) if not obj.has_key( "artifacts" ) : obj["artifacts"] = [] if not obj.has_key( "log" ) : obj["log"] = "" if not obj.has_key( "status" ) : obj["status"] = "unknown" if not obj.has_key( "name" ) : obj["name"] = _test.__doc__ if not obj.has_key( "test_id" ) : from testing_runtime import tests_config obj["test_id"] = tests_config.test_to_id( _test ) return obj