def test_list_files_recursive(): expected = [ 'test/fake-repos/fake-proto/excluded/excluded.proto', 'test/fake-repos/fake-proto/fake.pb.go', 'test/fake-repos/fake-proto/fake.proto', ] path = 'test/fake-repos/fake-proto' assert sorted(list(protoc_utils.list_files_recursive(path))) == expected
def test_list_files_recursive(): expected = [ 'test/fake-repos/fake-proto/fake.pb.go', 'test/fake-repos/fake-proto/fake.proto', 'test/fake-repos/fake-proto/excluded/excluded.proto', ] path = 'test/fake-repos/fake-proto' assert list(protoc_utils.list_files_recursive(path)) == expected
def execute(self, grpc_code_dir): for filename in protoc_utils.list_files_recursive(grpc_code_dir): if filename.endswith('GrpcClient.php'): logger.info('Performing replacements in: %s' % (filename,)) with io.open(filename, encoding='UTF-8') as f: contents = f.read() contents = protoc_utils.php_proto_rename(contents) with io.open(filename, 'w', encoding='UTF-8') as f: f.write(contents)
def execute(self, grpc_code_dir): for filename in protoc_utils.list_files_recursive(grpc_code_dir): if filename.endswith('GrpcClient.php'): logger.info('Performing replacements in: %s' % (filename, )) with io.open(filename, encoding='UTF-8') as f: contents = f.read() contents = protoc_utils.php_proto_rename(contents) with io.open(filename, 'w', encoding='UTF-8') as f: f.write(contents)