def _writePythonFiles(self, src, protoc, server): protos = [] for root, dirs, files in os.walk(src): protos.extend([ os.path.join(root, f) for f in fnmatch.filter(files, "*.proto")]) if len(protos) == 0: raise Exception("Didn't find any proto files in ".format(src)) cmd = "{protoc} -I {src} --python_out={server} {proto_files}".format( protoc=protoc, src=src, server=server, proto_files=" ".join(protos)) utils.runCommand(cmd)
def runTests(self): testCommands = self.parseTestCommands() for command in testCommands: self.log('Running: "{}"'.format(command)) utils.runCommand(command, shell=True) self.log('SUCCESS')
def testRunCommandSplits(self): utils.runCommandSplits(self.validCommand.split()) with self.assertRaises(subprocess.CalledProcessError): utils.runCommandSplits(self.invalidCommand.split(), silent=True) with self.assertRaises(Exception): utils.runCommand([self.nonexistentExecutable], silent=True)