From d7bc1a44c46e52174d4881924ebb6465ae427207 Mon Sep 17 00:00:00 2001 From: Dov Shlachter Date: Mon, 2 Dec 2019 13:22:17 -0800 Subject: [PATCH] Fix for #169: unused imports Fix the unused import of api_core.operation and protobuf.empty_pb2 in generated unit tests --- .../tests/unit/%name_%version/%sub/test_%service.py.j2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gapic/templates/tests/unit/%name_%version/%sub/test_%service.py.j2 b/gapic/templates/tests/unit/%name_%version/%sub/test_%service.py.j2 index 5eaa1b2ee5..94de746f9d 100644 --- a/gapic/templates/tests/unit/%name_%version/%sub/test_%service.py.j2 +++ b/gapic/templates/tests/unit/%name_%version/%sub/test_%service.py.j2 @@ -21,7 +21,9 @@ from google.api_core import operations_v1 from google.longrunning import operations_pb2 {% endif -%} {% for method in service.methods.values() -%} -{% for ref_type in method.ref_types -%} +{% for ref_type in method.ref_types + if not ((ref_type.ident.python_import.package == ('google', 'api_core') and ref_type.ident.python_import.module == 'operation') + or ref_type.ident.python_import.package == ('google', 'protobuf') and ref_type.ident.python_import.module == 'empty_pb2') -%} {{ ref_type.ident.python_import }} {% endfor -%} {% endfor -%}