예제 #1
0
파일: unit.py 프로젝트: sauter-hq/rethinkdb
 def configure(self, conf):
     unit_executable = os.path.join(conf['BUILD_DIR'], "rethinkdb-unittest")
     if not os.access(unit_executable, os.X_OK):
         sys.stderr.write(
             'Warning: no useable rethinkdb-unittest executable at: %s\n' %
             unit_executable)
         return test_framework.TestTree()
     gtestProcess = subprocess.Popen(
         [unit_executable, "--gtest_list_tests"],
         stdout=subprocess.PIPE,
         stderr=subprocess.STDOUT)
     output, _ = gtestProcess.communicate()
     if gtestProcess.returncode != 0:
         raise subprocess.CalledProcessError(
             gtestProcess.returncode,
             [unit_executable, "--gtest_list_tests"])
     key = None
     dict = collections.defaultdict(list)
     for line in output.split():
         if not line:
             continue
         elif line[-1] == '.':
             key = line[:-1]
         else:
             dict[key].append(line.strip())
     tests = test_framework.TestTree(
         (group, UnitTest(unit_executable, group, tests))
         for group, tests in dict.items())
     for filter in self.filters:
         tests = tests.filter(filter)
     return tests
예제 #2
0
 def filter(self, filter):
     if filter.all_same() or not self.child_tests:
         return self if filter.match() else None
     tests = test_framework.TestTree(
         ((child, UnitTest(self.unit_executable, self.test + "." + child))
          for child in self.child_tests))
     return tests.filter(filter)
예제 #3
0
 def configure(self, conf):
     unit_executable = os.path.join(conf['BUILD_DIR'], "rethinkdb-unittest")
     if not os.access(unit_executable, os.X_OK):
         sys.stderr.write(
             'Warning: no useable rethinkdb-unittest executable at: %s\n' %
             unit_executable)
         return test_framework.TestTree()
     output = subprocess.check_output(
         [unit_executable, "--gtest_list_tests"])
     key = None
     dict = collections.defaultdict(list)
     for line in output.split("\n"):
         if not line:
             continue
         elif line[-1] == '.':
             key = line[:-1]
         else:
             dict[key].append(line.strip())
     tests = test_framework.TestTree(
         (group, UnitTest(unit_executable, group, tests))
         for group, tests in dict.iteritems())
     for filter in self.filters:
         tests = tests.filter(filter)
     return tests