From ada7d68505033518d0b7ba246fc6c9f01bb36cb4 Mon Sep 17 00:00:00 2001 From: Chalmer Date: Thu, 5 Oct 2023 14:50:20 +0000 Subject: [PATCH 01/21] fix: adds new property and tests --- google/cloud/bigquery/job/base.py | 25 +++++++++++++++++++++++++ tests/system/test_query.py | 14 ++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/google/cloud/bigquery/job/base.py b/google/cloud/bigquery/job/base.py index a6267be41..424ad1948 100644 --- a/google/cloud/bigquery/job/base.py +++ b/google/cloud/bigquery/job/base.py @@ -171,6 +171,31 @@ def __setattr__(self, name, value): ) super(_JobConfig, self).__setattr__(name, value) + @property + def job_timeout_ms(self): + """Optional parameter. Job timeout in milliseconds. If this time limit is exceeded, BigQuery might attempt to stop the job. + https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfiguration.FIELDS.job_timeout_ms + e.g. + job_config = bigquery.QueryJobConfig( jobtimeout = 5000 ) + or + job_config.jobtimeout = 5000 + Raises: + ValueError: If ``value`` type is invalid. + """ + + # None as this is an optional parameter. + if self._properties.get("jobTimeoutMs"): + return self._properties["jobTimeoutMs"] + return None + + @job_timeout_ms.setter + def job_timeout_ms(self, value): + if not isinstance(value, int): + raise ValueError("Pass an int for jobTimeoutMs, e.g. 5000") + + """ Docs indicate a string is expected by the API """ + self._properties["jobTimeoutMs"] = str(value) + @property def labels(self): """Dict[str, str]: Labels for the job. diff --git a/tests/system/test_query.py b/tests/system/test_query.py index 723f927d7..f1298e69a 100644 --- a/tests/system/test_query.py +++ b/tests/system/test_query.py @@ -97,6 +97,20 @@ def test_query_w_timeout(bigquery_client, query_api_method): assert bigquery_client.cancel_job(query_job) is not None +def test_job_timeout_ms(): + # Confirm that default status is None. + job_config = bigquery.QueryJobConfig() + assert job_config.job_timeout_ms is None + + # Confirm that integers get converted to strings. + job_config.job_timeout_ms = 5000 + assert job_config.job_timeout_ms == "5000" # int is converted to string + + # Confirm that attempting to set a non-integer values will raise an Error. + with pytest.raises(ValueError): + job_config.job_timeout_ms = "WillRaiseError" + + def test_query_statistics(bigquery_client, query_api_method): """ A system test to exercise some of the extended query statistics. From 496472b689114c933c0dba631b393e78d623a202 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 5 Oct 2023 14:53:37 +0000 Subject: [PATCH 02/21] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- google/cloud/bigquery/job/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google/cloud/bigquery/job/base.py b/google/cloud/bigquery/job/base.py index 424ad1948..b7248eb82 100644 --- a/google/cloud/bigquery/job/base.py +++ b/google/cloud/bigquery/job/base.py @@ -194,7 +194,7 @@ def job_timeout_ms(self, value): raise ValueError("Pass an int for jobTimeoutMs, e.g. 5000") """ Docs indicate a string is expected by the API """ - self._properties["jobTimeoutMs"] = str(value) + self._properties["jobTimeoutMs"] = str(value) @property def labels(self): From 0cd9653d6d8bd32831f8e581581eefc5c6000aa3 Mon Sep 17 00:00:00 2001 From: Chalmer Date: Thu, 5 Oct 2023 15:37:53 +0000 Subject: [PATCH 03/21] updates docs to correct a sphinx failure --- google/cloud/bigquery/job/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/google/cloud/bigquery/job/base.py b/google/cloud/bigquery/job/base.py index b7248eb82..853c7d524 100644 --- a/google/cloud/bigquery/job/base.py +++ b/google/cloud/bigquery/job/base.py @@ -176,9 +176,11 @@ def job_timeout_ms(self): """Optional parameter. Job timeout in milliseconds. If this time limit is exceeded, BigQuery might attempt to stop the job. https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfiguration.FIELDS.job_timeout_ms e.g. + job_config = bigquery.QueryJobConfig( jobtimeout = 5000 ) - or + or job_config.jobtimeout = 5000 + Raises: ValueError: If ``value`` type is invalid. """ From 28a1fa918980b55163e9ddd918b2b43e19182e54 Mon Sep 17 00:00:00 2001 From: Chalmer Date: Thu, 5 Oct 2023 15:41:50 +0000 Subject: [PATCH 04/21] Updates formatting --- google/cloud/bigquery/job/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google/cloud/bigquery/job/base.py b/google/cloud/bigquery/job/base.py index 853c7d524..265ee6280 100644 --- a/google/cloud/bigquery/job/base.py +++ b/google/cloud/bigquery/job/base.py @@ -176,11 +176,11 @@ def job_timeout_ms(self): """Optional parameter. Job timeout in milliseconds. If this time limit is exceeded, BigQuery might attempt to stop the job. https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfiguration.FIELDS.job_timeout_ms e.g. - + job_config = bigquery.QueryJobConfig( jobtimeout = 5000 ) or job_config.jobtimeout = 5000 - + Raises: ValueError: If ``value`` type is invalid. """ From 5fbb7d621bd38d5e83fd4f739e2877d81692a6ee Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Thu, 5 Oct 2023 12:56:25 -0400 Subject: [PATCH 05/21] Update tests/system/test_query.py --- tests/system/test_query.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/system/test_query.py b/tests/system/test_query.py index f1298e69a..c5b50bc09 100644 --- a/tests/system/test_query.py +++ b/tests/system/test_query.py @@ -106,6 +106,7 @@ def test_job_timeout_ms(): job_config.job_timeout_ms = 5000 assert job_config.job_timeout_ms == "5000" # int is converted to string +def test_job_timeout_ms_raises_valueerror(): # Confirm that attempting to set a non-integer values will raise an Error. with pytest.raises(ValueError): job_config.job_timeout_ms = "WillRaiseError" From 36a2c1f07493305b67ec99df6d5b29872dd29122 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 5 Oct 2023 16:58:53 +0000 Subject: [PATCH 06/21] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- tests/system/test_query.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/system/test_query.py b/tests/system/test_query.py index c5b50bc09..40d9440f8 100644 --- a/tests/system/test_query.py +++ b/tests/system/test_query.py @@ -106,6 +106,7 @@ def test_job_timeout_ms(): job_config.job_timeout_ms = 5000 assert job_config.job_timeout_ms == "5000" # int is converted to string + def test_job_timeout_ms_raises_valueerror(): # Confirm that attempting to set a non-integer values will raise an Error. with pytest.raises(ValueError): From 968db9ae312c32dc863f92ddf4f71e8c8de6a824 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Wed, 11 Oct 2023 12:25:00 -0400 Subject: [PATCH 07/21] Update google/cloud/bigquery/job/base.py --- google/cloud/bigquery/job/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google/cloud/bigquery/job/base.py b/google/cloud/bigquery/job/base.py index 265ee6280..f2d6921a7 100644 --- a/google/cloud/bigquery/job/base.py +++ b/google/cloud/bigquery/job/base.py @@ -177,9 +177,9 @@ def job_timeout_ms(self): https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfiguration.FIELDS.job_timeout_ms e.g. - job_config = bigquery.QueryJobConfig( jobtimeout = 5000 ) + job_config = bigquery.QueryJobConfig( job_timeout_ms = 5000 ) or - job_config.jobtimeout = 5000 + job_config.job_timeout_ms = 5000 Raises: ValueError: If ``value`` type is invalid. From a3b84b49aa725b30328bf022548480c520c60fde Mon Sep 17 00:00:00 2001 From: Chalmer Date: Thu, 12 Oct 2023 14:36:48 +0000 Subject: [PATCH 08/21] updates one test and uses int_or_none --- google/cloud/bigquery/job/base.py | 9 +++++++-- tests/system/test_query.py | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/google/cloud/bigquery/job/base.py b/google/cloud/bigquery/job/base.py index f2d6921a7..78df9142f 100644 --- a/google/cloud/bigquery/job/base.py +++ b/google/cloud/bigquery/job/base.py @@ -26,6 +26,7 @@ from google.cloud.bigquery import _helpers from google.cloud.bigquery.retry import DEFAULT_RETRY +from google.cloud.bigquery._helpers import _int_or_none if typing.TYPE_CHECKING: # pragma: NO COVER from google.api_core import retry as retries @@ -192,8 +193,12 @@ def job_timeout_ms(self): @job_timeout_ms.setter def job_timeout_ms(self, value): - if not isinstance(value, int): - raise ValueError("Pass an int for jobTimeoutMs, e.g. 5000") + try: + value = _int_or_none(value) + except ValueError as err: + raise ValueError("Pass an int for jobTimeoutMs, e.g. 5000").with_traceback( + err.__traceback__ + ) """ Docs indicate a string is expected by the API """ self._properties["jobTimeoutMs"] = str(value) diff --git a/tests/system/test_query.py b/tests/system/test_query.py index 40d9440f8..6f804a32a 100644 --- a/tests/system/test_query.py +++ b/tests/system/test_query.py @@ -110,6 +110,7 @@ def test_job_timeout_ms(): def test_job_timeout_ms_raises_valueerror(): # Confirm that attempting to set a non-integer values will raise an Error. with pytest.raises(ValueError): + job_config = bigquery.QueryJobConfig() job_config.job_timeout_ms = "WillRaiseError" From b619e5b923dd0ba3dae461a8c2a486a3c746022f Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Tue, 24 Oct 2023 09:30:06 -0400 Subject: [PATCH 09/21] Update tests/system/test_query.py testing something. --- tests/system/test_query.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/test_query.py b/tests/system/test_query.py index 6f804a32a..a051913fc 100644 --- a/tests/system/test_query.py +++ b/tests/system/test_query.py @@ -99,7 +99,7 @@ def test_query_w_timeout(bigquery_client, query_api_method): def test_job_timeout_ms(): # Confirm that default status is None. - job_config = bigquery.QueryJobConfig() + job_config = bigquery._JobConfig() assert job_config.job_timeout_ms is None # Confirm that integers get converted to strings. From be2e945187b6f1aa3439216c17d6cd2484dbab56 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Tue, 24 Oct 2023 11:29:22 -0400 Subject: [PATCH 10/21] Update tests/system/test_query.py --- tests/system/test_query.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/test_query.py b/tests/system/test_query.py index a051913fc..6f804a32a 100644 --- a/tests/system/test_query.py +++ b/tests/system/test_query.py @@ -99,7 +99,7 @@ def test_query_w_timeout(bigquery_client, query_api_method): def test_job_timeout_ms(): # Confirm that default status is None. - job_config = bigquery._JobConfig() + job_config = bigquery.QueryJobConfig() assert job_config.job_timeout_ms is None # Confirm that integers get converted to strings. From 91edae43dee427b35ff155392b1932632ec7ab39 Mon Sep 17 00:00:00 2001 From: Chalmer Date: Tue, 24 Oct 2023 16:53:50 +0000 Subject: [PATCH 11/21] testing coverage feature --- noxfile.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index 93616485f..77dd7b3c6 100644 --- a/noxfile.py +++ b/noxfile.py @@ -164,7 +164,7 @@ def system(session): session.skip("RUN_SYSTEM_TESTS is set to false, skipping") # Sanity check: Only run system tests if the environment variable is set. - if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): + if not os.environ.get(" Super", ""): session.skip("Credentials must be set via environment variable.") # Use pre-release gRPC for system tests. @@ -192,7 +192,9 @@ def system(session): session.install("-e", f".{extras}", "-c", constraints_path) # Run py.test against the system tests. - session.run("py.test", "--quiet", os.path.join("tests", "system"), *session.posargs) + session.run("py.test", "--quiet", + #os.path.join("tests", "system"), + *session.posargs) @nox.session(python=DEFAULT_PYTHON_VERSION) @@ -272,7 +274,8 @@ def cover(session): test runs (not system test runs), and then erases coverage data. """ session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=100") + import sys + session.run("coverage", "report", "--show-missing", "--fail-under=100", "--branch", "--data-file=sys.stdout") session.run("coverage", "erase") From e2a05a9c0965bb807ace8bef2d05c3fb52c7e607 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 24 Oct 2023 16:56:43 +0000 Subject: [PATCH 12/21] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- noxfile.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/noxfile.py b/noxfile.py index 77dd7b3c6..08e981840 100644 --- a/noxfile.py +++ b/noxfile.py @@ -192,9 +192,12 @@ def system(session): session.install("-e", f".{extras}", "-c", constraints_path) # Run py.test against the system tests. - session.run("py.test", "--quiet", - #os.path.join("tests", "system"), - *session.posargs) + session.run( + "py.test", + "--quiet", + # os.path.join("tests", "system"), + *session.posargs, + ) @nox.session(python=DEFAULT_PYTHON_VERSION) @@ -275,7 +278,15 @@ def cover(session): """ session.install("coverage", "pytest-cov") import sys - session.run("coverage", "report", "--show-missing", "--fail-under=100", "--branch", "--data-file=sys.stdout") + + session.run( + "coverage", + "report", + "--show-missing", + "--fail-under=100", + "--branch", + "--data-file=sys.stdout", + ) session.run("coverage", "erase") From d694d71814d185fc5b5436b2dd597c2cc372120e Mon Sep 17 00:00:00 2001 From: Chalmer Date: Wed, 25 Oct 2023 13:28:27 +0000 Subject: [PATCH 13/21] minor edits --- tests/system/test_query.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/system/test_query.py b/tests/system/test_query.py index 6f804a32a..ded0e7044 100644 --- a/tests/system/test_query.py +++ b/tests/system/test_query.py @@ -98,13 +98,14 @@ def test_query_w_timeout(bigquery_client, query_api_method): def test_job_timeout_ms(): + assert True # Confirm that default status is None. - job_config = bigquery.QueryJobConfig() - assert job_config.job_timeout_ms is None + #job_config = bigquery.QueryJobConfig() + #assert job_config.job_timeout_ms is None # Confirm that integers get converted to strings. - job_config.job_timeout_ms = 5000 - assert job_config.job_timeout_ms == "5000" # int is converted to string + #job_config.job_timeout_ms = 5000 + #assert job_config.job_timeout_ms == "5000" # int is converted to string def test_job_timeout_ms_raises_valueerror(): From 037417aa57bf5a386bad8436c5fa1715dcb06204 Mon Sep 17 00:00:00 2001 From: Chalmer Date: Wed, 25 Oct 2023 13:29:10 +0000 Subject: [PATCH 14/21] tweaks to noxfile for testing purposes --- noxfile.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/noxfile.py b/noxfile.py index 08e981840..a1e5fb187 100644 --- a/noxfile.py +++ b/noxfile.py @@ -277,15 +277,11 @@ def cover(session): test runs (not system test runs), and then erases coverage data. """ session.install("coverage", "pytest-cov") - import sys - session.run( "coverage", "report", "--show-missing", - "--fail-under=100", - "--branch", - "--data-file=sys.stdout", + "--fail-under=100" ) session.run("coverage", "erase") From 4bbb4df3ee4f4e43eefc6ddfae9803276d84f83c Mon Sep 17 00:00:00 2001 From: Chalmer Date: Wed, 25 Oct 2023 15:12:13 +0000 Subject: [PATCH 15/21] add new test to base as experiment --- tests/unit/job/test_base.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/unit/job/test_base.py b/tests/unit/job/test_base.py index a662e92d4..549c521aa 100644 --- a/tests/unit/job/test_base.py +++ b/tests/unit/job/test_base.py @@ -1228,3 +1228,9 @@ def test_labels_setter(self): job_config = self._make_one() job_config.labels = labels self.assertEqual(job_config._properties["labels"], labels) + + def test_job_timeout_ms_raises_valueerror(): + # Confirm that attempting to set a non-integer values will raise an Error. + with pytest.raises(ValueError): + job_config = bigquery.QueryJobConfig() + job_config.job_timeout_ms = "WillRaiseError" \ No newline at end of file From 0d9ae329bc81f810d211653209ae1519340690dc Mon Sep 17 00:00:00 2001 From: Chalmer Date: Mon, 13 Nov 2023 15:11:56 +0000 Subject: [PATCH 16/21] adds a test, updates import statements --- tests/unit/job/test_base.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/unit/job/test_base.py b/tests/unit/job/test_base.py index 549c521aa..cf0d3e6fe 100644 --- a/tests/unit/job/test_base.py +++ b/tests/unit/job/test_base.py @@ -1232,5 +1232,16 @@ def test_labels_setter(self): def test_job_timeout_ms_raises_valueerror(): # Confirm that attempting to set a non-integer values will raise an Error. with pytest.raises(ValueError): - job_config = bigquery.QueryJobConfig() - job_config.job_timeout_ms = "WillRaiseError" \ No newline at end of file + from google.cloud.bigquery import QueryJobConfig + job_config = QueryJobConfig() + job_config.job_timeout_ms = "WillRaiseError" + + def test_job_timeout_ms(): + # Confirm that default status is None. + from google.cloud.bigquery import QueryJobConfig + job_config = QueryJobConfig() + assert job_config.job_timeout_ms is None + + # Confirm that integers get converted to strings. + #job_config.job_timeout_ms = 5000 + #assert job_config.job_timeout_ms == "5000" # int is converted to string \ No newline at end of file From dc585d54592b372707c76c3b284085427a39011b Mon Sep 17 00:00:00 2001 From: Chalmer Date: Mon, 13 Nov 2023 15:53:35 +0000 Subject: [PATCH 17/21] add another test --- tests/unit/job/test_base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/job/test_base.py b/tests/unit/job/test_base.py index cf0d3e6fe..100f911aa 100644 --- a/tests/unit/job/test_base.py +++ b/tests/unit/job/test_base.py @@ -1243,5 +1243,5 @@ def test_job_timeout_ms(): assert job_config.job_timeout_ms is None # Confirm that integers get converted to strings. - #job_config.job_timeout_ms = 5000 - #assert job_config.job_timeout_ms == "5000" # int is converted to string \ No newline at end of file + job_config.job_timeout_ms = 5000 + assert job_config.job_timeout_ms == "5000" # int is converted to string \ No newline at end of file From aa4d302de52ff58cc3d1a8f5a6222cc24324d55d Mon Sep 17 00:00:00 2001 From: Chalmer Date: Mon, 13 Nov 2023 16:10:59 +0000 Subject: [PATCH 18/21] edit to tests --- tests/unit/job/test_base.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/unit/job/test_base.py b/tests/unit/job/test_base.py index 100f911aa..de92ff38e 100644 --- a/tests/unit/job/test_base.py +++ b/tests/unit/job/test_base.py @@ -1229,17 +1229,17 @@ def test_labels_setter(self): job_config.labels = labels self.assertEqual(job_config._properties["labels"], labels) - def test_job_timeout_ms_raises_valueerror(): + def test_job_timeout_ms_raises_valueerror(self): # Confirm that attempting to set a non-integer values will raise an Error. with pytest.raises(ValueError): - from google.cloud.bigquery import QueryJobConfig - job_config = QueryJobConfig() + #from google.cloud.bigquery import QueryJobConfig + #job_config = QueryJobConfig() + job_config = self._make_one() job_config.job_timeout_ms = "WillRaiseError" - def test_job_timeout_ms(): + def test_job_timeout_ms(self): # Confirm that default status is None. - from google.cloud.bigquery import QueryJobConfig - job_config = QueryJobConfig() + job_config = self._make_one() assert job_config.job_timeout_ms is None # Confirm that integers get converted to strings. From 6e72fd480cc9ef9fd8d8e2a1da7472d2a72745d6 Mon Sep 17 00:00:00 2001 From: Chalmer Date: Mon, 13 Nov 2023 17:02:45 +0000 Subject: [PATCH 19/21] formatting fixes --- tests/system/test_query.py | 18 ------------------ tests/unit/job/test_base.py | 6 +++--- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/tests/system/test_query.py b/tests/system/test_query.py index ded0e7044..723f927d7 100644 --- a/tests/system/test_query.py +++ b/tests/system/test_query.py @@ -97,24 +97,6 @@ def test_query_w_timeout(bigquery_client, query_api_method): assert bigquery_client.cancel_job(query_job) is not None -def test_job_timeout_ms(): - assert True - # Confirm that default status is None. - #job_config = bigquery.QueryJobConfig() - #assert job_config.job_timeout_ms is None - - # Confirm that integers get converted to strings. - #job_config.job_timeout_ms = 5000 - #assert job_config.job_timeout_ms == "5000" # int is converted to string - - -def test_job_timeout_ms_raises_valueerror(): - # Confirm that attempting to set a non-integer values will raise an Error. - with pytest.raises(ValueError): - job_config = bigquery.QueryJobConfig() - job_config.job_timeout_ms = "WillRaiseError" - - def test_query_statistics(bigquery_client, query_api_method): """ A system test to exercise some of the extended query statistics. diff --git a/tests/unit/job/test_base.py b/tests/unit/job/test_base.py index de92ff38e..a2e9501bb 100644 --- a/tests/unit/job/test_base.py +++ b/tests/unit/job/test_base.py @@ -1232,8 +1232,8 @@ def test_labels_setter(self): def test_job_timeout_ms_raises_valueerror(self): # Confirm that attempting to set a non-integer values will raise an Error. with pytest.raises(ValueError): - #from google.cloud.bigquery import QueryJobConfig - #job_config = QueryJobConfig() + # from google.cloud.bigquery import QueryJobConfig + # job_config = QueryJobConfig() job_config = self._make_one() job_config.job_timeout_ms = "WillRaiseError" @@ -1244,4 +1244,4 @@ def test_job_timeout_ms(self): # Confirm that integers get converted to strings. job_config.job_timeout_ms = 5000 - assert job_config.job_timeout_ms == "5000" # int is converted to string \ No newline at end of file + assert job_config.job_timeout_ms == "5000" # int is converted to string From 69365f5affc678b58dd4752e8e3f20409374c62f Mon Sep 17 00:00:00 2001 From: Chalmer Date: Tue, 14 Nov 2023 11:35:40 +0000 Subject: [PATCH 20/21] update noxfile to correct debug code --- noxfile.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/noxfile.py b/noxfile.py index a1e5fb187..2c6ec2d5a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -164,7 +164,7 @@ def system(session): session.skip("RUN_SYSTEM_TESTS is set to false, skipping") # Sanity check: Only run system tests if the environment variable is set. - if not os.environ.get(" Super", ""): + if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): session.skip("Credentials must be set via environment variable.") # Use pre-release gRPC for system tests. @@ -195,7 +195,7 @@ def system(session): session.run( "py.test", "--quiet", - # os.path.join("tests", "system"), + os.path.join("tests", "system"), *session.posargs, ) @@ -277,12 +277,7 @@ def cover(session): test runs (not system test runs), and then erases coverage data. """ session.install("coverage", "pytest-cov") - session.run( - "coverage", - "report", - "--show-missing", - "--fail-under=100" - ) + session.run("coverage", "report", "--show-missing", "--fail-under=100") session.run("coverage", "erase") From edaaf1977d46a565dc04911302dc53c65805f5ef Mon Sep 17 00:00:00 2001 From: Chalmer Date: Thu, 16 Nov 2023 11:55:29 +0000 Subject: [PATCH 21/21] removes unneeded comments. --- tests/unit/job/test_base.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/unit/job/test_base.py b/tests/unit/job/test_base.py index a2e9501bb..5635d0e32 100644 --- a/tests/unit/job/test_base.py +++ b/tests/unit/job/test_base.py @@ -1232,8 +1232,6 @@ def test_labels_setter(self): def test_job_timeout_ms_raises_valueerror(self): # Confirm that attempting to set a non-integer values will raise an Error. with pytest.raises(ValueError): - # from google.cloud.bigquery import QueryJobConfig - # job_config = QueryJobConfig() job_config = self._make_one() job_config.job_timeout_ms = "WillRaiseError"