From 34d9beca7d9aab5a4871c819a5cd2434f48a090d Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Fri, 25 Mar 2022 15:19:39 -0600 Subject: [PATCH] fix(deps): require google-api-core >= 1.31.5, >= 2.3.2 on v1 release (#1166) * chore(deps): allow google-api-core v2 on v1 release * chore: also update cloud-core * test: update tests to support latest google-cloud-core (#276) `google-cloud-core` version 1.4.2 populates `prettyPrint=false` by default. Update the connection tests to expect a value for `prettyPrint`. * ci: fix docs build * chore: update system tests and samples to use and @google.com email address (#942) * chore: update system tests and samples to use and @google.com email address * Add group prefix * fixed access entry some more Co-authored-by: Tim Swast Co-authored-by: Anthonios Partheniou Co-authored-by: Jim Fulton --- noxfile.py | 35 +------------------------------- samples/update_dataset_access.py | 4 ++-- setup.py | 4 ++-- tests/unit/test__http.py | 28 ++++++++++++++++++++----- 4 files changed, 28 insertions(+), 43 deletions(-) diff --git a/noxfile.py b/noxfile.py index 90f023add..254992b76 100644 --- a/noxfile.py +++ b/noxfile.py @@ -206,7 +206,7 @@ def blacken(session): def docs(session): """Build the docs.""" - session.install("ipython", "recommonmark", "sphinx", "sphinx_rtd_theme") + session.install("ipython", "recommonmark", "sphinx<3.0.0", "sphinx_rtd_theme") session.install("google-cloud-storage") session.install("-e", ".[all]") @@ -223,36 +223,3 @@ def docs(session): os.path.join("docs", ""), os.path.join("docs", "_build", "html", ""), ) - - -@nox.session(python="3.8") -def docfx(session): - """Build the docfx yaml files for this library.""" - - session.install("-e", ".") - session.install("sphinx", "alabaster", "recommonmark", "sphinx-docfx-yaml") - - shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) - session.run( - "sphinx-build", - "-T", # show full traceback on exception - "-N", # no colors - "-D", - ( - "extensions=sphinx.ext.autodoc," - "sphinx.ext.autosummary," - "docfx_yaml.extension," - "sphinx.ext.intersphinx," - "sphinx.ext.coverage," - "sphinx.ext.napoleon," - "sphinx.ext.todo," - "sphinx.ext.viewcode," - "recommonmark" - ), - "-b", - "html", - "-d", - os.path.join("docs", "_build", "doctrees", ""), - os.path.join("docs", ""), - os.path.join("docs", "_build", "html", ""), - ) diff --git a/samples/update_dataset_access.py b/samples/update_dataset_access.py index 6e844cc90..a5c2670e7 100644 --- a/samples/update_dataset_access.py +++ b/samples/update_dataset_access.py @@ -28,8 +28,8 @@ def update_dataset_access(dataset_id): entry = bigquery.AccessEntry( role="READER", - entity_type="userByEmail", - entity_id="sample.bigquery.dev@gmail.com", + entity_type="groupByEmail", + entity_id="cloud-developer-relations@google.com", ) entries = list(dataset.access_entries) diff --git a/setup.py b/setup.py index 73d9a03ca..c3ec8e413 100644 --- a/setup.py +++ b/setup.py @@ -30,8 +30,8 @@ release_status = "Development Status :: 5 - Production/Stable" dependencies = [ 'enum34; python_version < "3.4"', - "google-api-core >= 1.21.0, < 2.0dev", - "google-cloud-core >= 1.4.1, < 2.0dev", + "google-api-core >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", + "google-cloud-core >= 1.4.1, < 3.0dev", "google-resumable-media >= 0.6.0, < 2.0dev", "six >=1.13.0,< 2.0.0dev", ] diff --git a/tests/unit/test__http.py b/tests/unit/test__http.py index 4da805d48..691c4c802 100644 --- a/tests/unit/test__http.py +++ b/tests/unit/test__http.py @@ -35,15 +35,33 @@ def _make_one(self, *args, **kw): return self._get_target_class()(*args, **kw) def test_build_api_url_no_extra_query_params(self): + from six.moves.urllib.parse import parse_qsl + from six.moves.urllib.parse import urlsplit + conn = self._make_one(object()) - URI = "/".join([conn.DEFAULT_API_ENDPOINT, "bigquery", conn.API_VERSION, "foo"]) - self.assertEqual(conn.build_api_url("/foo"), URI) + uri = conn.build_api_url("/foo") + scheme, netloc, path, qs, _ = urlsplit(uri) + self.assertEqual("%s://%s" % (scheme, netloc), conn.API_BASE_URL) + self.assertEqual(path, "/".join(["", "bigquery", conn.API_VERSION, "foo"])) + parms = dict(parse_qsl(qs)) + pretty_print = parms.pop("prettyPrint", "false") + self.assertEqual(pretty_print, "false") + self.assertEqual(parms, {}) def test_build_api_url_w_custom_endpoint(self): - custom_endpoint = "https://www.foo-googleapis.com" + from six.moves.urllib.parse import parse_qsl + from six.moves.urllib.parse import urlsplit + + custom_endpoint = "https://foo-bigquery.googleapis.com" conn = self._make_one(object(), api_endpoint=custom_endpoint) - URI = "/".join([custom_endpoint, "bigquery", conn.API_VERSION, "foo"]) - self.assertEqual(conn.build_api_url("/foo"), URI) + uri = conn.build_api_url("/foo") + scheme, netloc, path, qs, _ = urlsplit(uri) + self.assertEqual("%s://%s" % (scheme, netloc), custom_endpoint) + self.assertEqual(path, "/".join(["", "bigquery", conn.API_VERSION, "foo"])) + parms = dict(parse_qsl(qs)) + pretty_print = parms.pop("prettyPrint", "false") + self.assertEqual(pretty_print, "false") + self.assertEqual(parms, {}) def test_build_api_url_w_extra_query_params(self): from six.moves.urllib.parse import parse_qsl