From ffd1ac185e33299d8981f09b3183680eef25df02 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Mon, 26 Oct 2020 16:50:03 -0400 Subject: [PATCH] tests: restore 100% coverage (#234) - Ignore 'DistributionNotFound' fallbacks (only in setuptools-less installs). - Drop unused helper (fossil from PR #225). release-as: 2.0.0-dev2 --- .coveragerc | 2 ++ google/cloud/firestore_v1/base_client.py | 11 ----------- synth.py | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.coveragerc b/.coveragerc index 0d8e6297d..1ba5bb57d 100644 --- a/.coveragerc +++ b/.coveragerc @@ -30,6 +30,8 @@ exclude_lines = def __repr__ # Ignore abstract methods raise NotImplementedError + # Ignore setuptools-less fallback + except pkg_resources.DistributionNotFound: omit = */gapic/*.py */proto/*.py diff --git a/google/cloud/firestore_v1/base_client.py b/google/cloud/firestore_v1/base_client.py index 22afb09de..f532ec1b7 100644 --- a/google/cloud/firestore_v1/base_client.py +++ b/google/cloud/firestore_v1/base_client.py @@ -536,17 +536,6 @@ def _get_doc_mask(field_paths: Iterable[str]) -> Optional[types.common.DocumentM return types.DocumentMask(field_paths=field_paths) -def _item_to_collection_ref(iterator, item: str) -> BaseCollectionReference: - """Convert collection ID to collection ref. - - Args: - iterator (google.api_core.page_iterator.GRPCIterator): - iterator response - item (str): ID of the collection - """ - return iterator.client.collection(item) - - def _path_helper(path: tuple) -> Tuple[str]: """Standardize path into a tuple of path segments. diff --git a/synth.py b/synth.py index 07ce56148..8a363c592 100644 --- a/synth.py +++ b/synth.py @@ -191,6 +191,20 @@ def lint_setup_py(session): """, ) +s.replace( + ".coveragerc", + """\ + raise NotImplementedError +omit = +""", + """\ + raise NotImplementedError + # Ignore setuptools-less fallback + except pkg_resources.DistributionNotFound: +omit = +""", +) + s.shell.run(["nox", "-s", "blacken"], hide_output=False) s.replace(