示例#1
0
def assertPermissions():
    stat_info = os.stat('.')
    if stat_info.st_uid != os.getuid():
        print(utils.lightred("Will not load modules/extensions in tests."))
        print(utils.lightred("Repository owner (%d) executer (%d) mismatch" % (
            stat_info.st_uid, os.getuid())))
        exit(1)
示例#2
0
def assertPermissions():
    stat_info = os.stat('.')
    if stat_info.st_uid != os.getuid():
        print (utils.lightred("Will not load modules/extensions in tests."))
        print (utils.lightred("Repository owner (%d) executer (%d) mismatch" % (
            stat_info.st_uid, os.getuid())))
        exit(1)
示例#3
0
 def _execute(self, query):
     try:
         result = self.em.query(query)
         self.assertEqual(result.status.code, 0)
         return result.response
     except Exception as e:
         print("General exception executing query: %s" % (utils.lightred(query)))
         raise e
示例#4
0
 def _execute(self, query):
     try:
         result = self.em.query(query)
         self.assertEqual(result.status.code, 0)
         return result.response
     except Exception as e:
         print("General exception executing query: %s (%s)" %
               (utils.lightred(query), str(e)))
         raise e
示例#5
0
 def _execute_set(self, queries):
     for example in queries:
         start_time = time.time()
         result = self._execute(example)
         end_time = time.time()
         duration_ms = int((end_time - start_time) * 1000)
         if duration_ms > 2000:
             # Query took longer than 2 seconds.
             duration_ms = utils.lightred(duration_ms)
         print("Query (%sms): %s, rows: %d" % (duration_ms, example, len(result)))
示例#6
0
 def _execute_set(self, queries):
     for example in queries:
         start_time = time.time()
         result = self._execute(example)
         end_time = time.time()
         duration_ms = int((end_time - start_time) * 1000)
         if duration_ms > 2000:
             # Query took longer than 2 seconds.
             duration_ms = utils.lightred(duration_ms)
         print("Query (%sms): %s, rows: %d" %
               (duration_ms, example, len(result)))