From f00da8e0d249bfc1a90d28afd845be37c762ab9f Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Fri, 29 Mar 2024 07:14:32 -0400 Subject: [PATCH 01/15] creates linting-typing.cfg in presubmit --- .kokoro/presubmit/linting-typing.cfg | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .kokoro/presubmit/linting-typing.cfg diff --git a/.kokoro/presubmit/linting-typing.cfg b/.kokoro/presubmit/linting-typing.cfg new file mode 100644 index 000000000..b1a7406c2 --- /dev/null +++ b/.kokoro/presubmit/linting-typing.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Only run these nox sessions. +env_vars: { + key: "NOX_SESSION" + value: "lint lint_setup_py blacken mypy mypy_samples pytype" +} From 665d76022e0fd35dbebfe041928de2241de1441a Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Fri, 29 Mar 2024 09:20:58 -0400 Subject: [PATCH 02/15] attempt to filter out linting and typing tests from presubmit --- .kokoro/presubmit/presubmit.cfg | 9 +++++++++ noxfile.py | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/.kokoro/presubmit/presubmit.cfg b/.kokoro/presubmit/presubmit.cfg index 17d071cae..5f05ded1f 100644 --- a/.kokoro/presubmit/presubmit.cfg +++ b/.kokoro/presubmit/presubmit.cfg @@ -9,3 +9,12 @@ env_vars: { key: "RUN_SNIPPETS_TESTS" value: "false" } +env_vars: { + key: "RUN_TYPING_TESTS" + value: "false" +} +env_vars: { + key: "RUN_LINTING_TESTS" + value: "false" +} + diff --git a/noxfile.py b/noxfile.py index 3adb4ba70..4fe39ecac 100644 --- a/noxfile.py +++ b/noxfile.py @@ -132,6 +132,10 @@ def unit_noextras(session): def mypy(session): """Run type checks with mypy.""" + # Check the value of `RUN_TYPING_TESTS` env var. It defaults to true. + if os.environ.get("RUN_TYPING_TESTS", "true") == "false": + session.skip("RUN_TYPING_TESTS is set to false, skipping") + session.install("-e", ".[all]") session.install(MYPY_VERSION) @@ -153,6 +157,10 @@ def pytype(session): # recent version avoids the error until a possibly better fix is found. # https://github.com/googleapis/python-bigquery/issues/655 + # Check the value of `RUN_TYPING_TESTS` env var. It defaults to true. + if os.environ.get("RUN_TYPING_TESTS", "true") == "false": + session.skip("RUN_TYPING_TESTS is set to false, skipping") + session.install("attrs==20.3.0") session.install("-e", ".[all]") session.install(PYTYPE_VERSION) @@ -213,6 +221,11 @@ def system(session): def mypy_samples(session): """Run type checks with mypy.""" + # Check the value of `RUN_TYPING_TESTS` env var. It defaults to true. + if os.environ.get("RUN_TYPING_TESTS", "true") == "false": + session.skip("RUN_TYPING_TESTS is set to false, skipping") + + session.install("pytest") for requirements_path in CURRENT_DIRECTORY.glob("samples/*/requirements.txt"): session.install("-r", str(requirements_path)) @@ -394,6 +407,10 @@ def lint(session): serious code quality issues. """ + # Check the value of `RUN_LINTING_TESTS` env var. It defaults to true. + if os.environ.get("RUN_LINTING_TESTS", "true") == "false": + session.skip("RUN_LINTING_TESTS is set to false, skipping") + session.install("flake8", BLACK_VERSION) session.install("-e", ".") session.run("flake8", os.path.join("google", "cloud", "bigquery")) @@ -408,6 +425,10 @@ def lint(session): def lint_setup_py(session): """Verify that setup.py is valid (including RST check).""" + # Check the value of `RUN_LINTING_TESTS` env var. It defaults to true. + if os.environ.get("RUN_LINTING_TESTS", "true") == "false": + session.skip("RUN_LINTING_TESTS is set to false, skipping") + session.install("docutils", "Pygments") session.run("python", "setup.py", "check", "--restructuredtext", "--strict") @@ -418,6 +439,10 @@ def blacken(session): Format code to uniform standard. """ + # Check the value of `RUN_LINTING_TESTS` env var. It defaults to true. + if os.environ.get("RUN_LINTING_TESTS", "true") == "false": + session.skip("RUN_LINTING_TESTS is set to false, skipping") + session.install(BLACK_VERSION) session.run("black", *BLACK_PATHS) From a150a660f1e195319a79d63349707a0ac1313ef4 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Fri, 29 Mar 2024 09:22:44 -0400 Subject: [PATCH 03/15] lints and blackens this commit --- .kokoro/presubmit/presubmit.cfg | 1 - noxfile.py | 1 - 2 files changed, 2 deletions(-) diff --git a/.kokoro/presubmit/presubmit.cfg b/.kokoro/presubmit/presubmit.cfg index 5f05ded1f..944c72403 100644 --- a/.kokoro/presubmit/presubmit.cfg +++ b/.kokoro/presubmit/presubmit.cfg @@ -17,4 +17,3 @@ env_vars: { key: "RUN_LINTING_TESTS" value: "false" } - diff --git a/noxfile.py b/noxfile.py index 4fe39ecac..4379392f7 100644 --- a/noxfile.py +++ b/noxfile.py @@ -225,7 +225,6 @@ def mypy_samples(session): if os.environ.get("RUN_TYPING_TESTS", "true") == "false": session.skip("RUN_TYPING_TESTS is set to false, skipping") - session.install("pytest") for requirements_path in CURRENT_DIRECTORY.glob("samples/*/requirements.txt"): session.install("-r", str(requirements_path)) From 286362e96ac43e14dd2f9ee67a64ade042b46def Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Fri, 29 Mar 2024 14:36:00 -0400 Subject: [PATCH 04/15] revise environmental variables --- .kokoro/presubmit/presubmit.cfg | 6 +----- noxfile.py | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.kokoro/presubmit/presubmit.cfg b/.kokoro/presubmit/presubmit.cfg index 944c72403..fa39b1118 100644 --- a/.kokoro/presubmit/presubmit.cfg +++ b/.kokoro/presubmit/presubmit.cfg @@ -10,10 +10,6 @@ env_vars: { value: "false" } env_vars: { - key: "RUN_TYPING_TESTS" - value: "false" -} -env_vars: { - key: "RUN_LINTING_TESTS" + key: "RUN_LINTING_TYPING_TESTS" value: "false" } diff --git a/noxfile.py b/noxfile.py index 4379392f7..13df3a53c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -133,8 +133,8 @@ def mypy(session): """Run type checks with mypy.""" # Check the value of `RUN_TYPING_TESTS` env var. It defaults to true. - if os.environ.get("RUN_TYPING_TESTS", "true") == "false": - session.skip("RUN_TYPING_TESTS is set to false, skipping") + if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false": + session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping") session.install("-e", ".[all]") session.install(MYPY_VERSION) @@ -158,8 +158,8 @@ def pytype(session): # https://github.com/googleapis/python-bigquery/issues/655 # Check the value of `RUN_TYPING_TESTS` env var. It defaults to true. - if os.environ.get("RUN_TYPING_TESTS", "true") == "false": - session.skip("RUN_TYPING_TESTS is set to false, skipping") + if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false": + session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping") session.install("attrs==20.3.0") session.install("-e", ".[all]") @@ -222,8 +222,8 @@ def mypy_samples(session): """Run type checks with mypy.""" # Check the value of `RUN_TYPING_TESTS` env var. It defaults to true. - if os.environ.get("RUN_TYPING_TESTS", "true") == "false": - session.skip("RUN_TYPING_TESTS is set to false, skipping") + if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false": + session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping") session.install("pytest") for requirements_path in CURRENT_DIRECTORY.glob("samples/*/requirements.txt"): @@ -407,8 +407,8 @@ def lint(session): """ # Check the value of `RUN_LINTING_TESTS` env var. It defaults to true. - if os.environ.get("RUN_LINTING_TESTS", "true") == "false": - session.skip("RUN_LINTING_TESTS is set to false, skipping") + if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false": + session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping") session.install("flake8", BLACK_VERSION) session.install("-e", ".") @@ -425,8 +425,8 @@ def lint_setup_py(session): """Verify that setup.py is valid (including RST check).""" # Check the value of `RUN_LINTING_TESTS` env var. It defaults to true. - if os.environ.get("RUN_LINTING_TESTS", "true") == "false": - session.skip("RUN_LINTING_TESTS is set to false, skipping") + if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false": + session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping") session.install("docutils", "Pygments") session.run("python", "setup.py", "check", "--restructuredtext", "--strict") @@ -439,8 +439,8 @@ def blacken(session): """ # Check the value of `RUN_LINTING_TESTS` env var. It defaults to true. - if os.environ.get("RUN_LINTING_TESTS", "true") == "false": - session.skip("RUN_LINTING_TESTS is set to false, skipping") + if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false": + session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping") session.install(BLACK_VERSION) session.run("black", *BLACK_PATHS) From db48b8fad7e19a14fbf9c2b2850112ebea6ae875 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Fri, 29 Mar 2024 15:43:40 -0400 Subject: [PATCH 05/15] Update noxfile.py --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 13df3a53c..ea2d1910f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -132,7 +132,7 @@ def unit_noextras(session): def mypy(session): """Run type checks with mypy.""" - # Check the value of `RUN_TYPING_TESTS` env var. It defaults to true. + # Check the value of `RUN_LINTING_TYPING_TESTS` env var. It defaults to true. if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false": session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping") From eb3dff815dc5eba4d964adf733c358d8ded51f20 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Fri, 29 Mar 2024 15:43:52 -0400 Subject: [PATCH 06/15] Update noxfile.py --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index ea2d1910f..3bbd62a3a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -438,7 +438,7 @@ def blacken(session): Format code to uniform standard. """ - # Check the value of `RUN_LINTING_TESTS` env var. It defaults to true. + # Check the value of `RUN_LINTING_TYPING_TESTS` env var. It defaults to true. if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false": session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping") From 218d3374af6dacfaecd4ec5acf6b2ebf8b411856 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Fri, 29 Mar 2024 15:44:00 -0400 Subject: [PATCH 07/15] Update noxfile.py --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 3bbd62a3a..4e834bb13 100644 --- a/noxfile.py +++ b/noxfile.py @@ -157,7 +157,7 @@ def pytype(session): # recent version avoids the error until a possibly better fix is found. # https://github.com/googleapis/python-bigquery/issues/655 - # Check the value of `RUN_TYPING_TESTS` env var. It defaults to true. + # Check the value of `RUN_LINTING_TYPING_TESTS` env var. It defaults to true. if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false": session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping") From 236aebe07d40bc4b9afd817f05de4ca94bfe7547 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Fri, 29 Mar 2024 15:44:06 -0400 Subject: [PATCH 08/15] Update noxfile.py --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 4e834bb13..38e46f046 100644 --- a/noxfile.py +++ b/noxfile.py @@ -221,7 +221,7 @@ def system(session): def mypy_samples(session): """Run type checks with mypy.""" - # Check the value of `RUN_TYPING_TESTS` env var. It defaults to true. + # Check the value of `RUN_LINTING_TYPING_TESTS` env var. It defaults to true. if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false": session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping") From 5ecb7441b1e254abca535ed5517be886eed21c8e Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Fri, 29 Mar 2024 15:44:12 -0400 Subject: [PATCH 09/15] Update noxfile.py --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 38e46f046..bccd30533 100644 --- a/noxfile.py +++ b/noxfile.py @@ -406,7 +406,7 @@ def lint(session): serious code quality issues. """ - # Check the value of `RUN_LINTING_TESTS` env var. It defaults to true. + # Check the value of `RUN_LINTING_TYPING_TESTS` env var. It defaults to true. if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false": session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping") From 850c377a662197ce5939442cf5276035bdf04905 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Fri, 29 Mar 2024 15:44:18 -0400 Subject: [PATCH 10/15] Update noxfile.py --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index bccd30533..034bb843a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -424,7 +424,7 @@ def lint(session): def lint_setup_py(session): """Verify that setup.py is valid (including RST check).""" - # Check the value of `RUN_LINTING_TESTS` env var. It defaults to true. + # Check the value of `RUN_LINTING_TYPING_TESTS` env var. It defaults to true. if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false": session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping") From 46a52cf9ac78a221810c4487583d59c19e79b2df Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Tue, 2 Apr 2024 11:24:56 -0400 Subject: [PATCH 11/15] Update .kokoro/presubmit/linting-typing.cfg --- .kokoro/presubmit/linting-typing.cfg | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.kokoro/presubmit/linting-typing.cfg b/.kokoro/presubmit/linting-typing.cfg index b1a7406c2..bab629f4e 100644 --- a/.kokoro/presubmit/linting-typing.cfg +++ b/.kokoro/presubmit/linting-typing.cfg @@ -5,3 +5,7 @@ env_vars: { key: "NOX_SESSION" value: "lint lint_setup_py blacken mypy mypy_samples pytype" } +env_vars: { + key: "RUN_LINTING_TYPING_TESTS" + value: "true" +} From 1f0b0b199f5f18d7d6f18e3f213985019243ae12 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Tue, 2 Apr 2024 11:28:31 -0400 Subject: [PATCH 12/15] Update .kokoro/presubmit/linting-typing.cfg --- .kokoro/presubmit/linting-typing.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/presubmit/linting-typing.cfg b/.kokoro/presubmit/linting-typing.cfg index bab629f4e..b92fec009 100644 --- a/.kokoro/presubmit/linting-typing.cfg +++ b/.kokoro/presubmit/linting-typing.cfg @@ -7,5 +7,5 @@ env_vars: { } env_vars: { key: "RUN_LINTING_TYPING_TESTS" - value: "true" + value: "false" } From deb5e415e605890c043bb527d75b974d77467cde Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Tue, 2 Apr 2024 11:32:01 -0400 Subject: [PATCH 13/15] Update .kokoro/presubmit/linting-typing.cfg --- .kokoro/presubmit/linting-typing.cfg | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.kokoro/presubmit/linting-typing.cfg b/.kokoro/presubmit/linting-typing.cfg index b92fec009..b1a7406c2 100644 --- a/.kokoro/presubmit/linting-typing.cfg +++ b/.kokoro/presubmit/linting-typing.cfg @@ -5,7 +5,3 @@ env_vars: { key: "NOX_SESSION" value: "lint lint_setup_py blacken mypy mypy_samples pytype" } -env_vars: { - key: "RUN_LINTING_TYPING_TESTS" - value: "false" -} From 7225af0c8b252dc0b821079b288e14f66b7d3536 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Tue, 2 Apr 2024 11:43:47 -0400 Subject: [PATCH 14/15] Update .kokoro/presubmit/presubmit.cfg --- .kokoro/presubmit/presubmit.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/presubmit/presubmit.cfg b/.kokoro/presubmit/presubmit.cfg index fa39b1118..fb65d4fdf 100644 --- a/.kokoro/presubmit/presubmit.cfg +++ b/.kokoro/presubmit/presubmit.cfg @@ -11,5 +11,5 @@ env_vars: { } env_vars: { key: "RUN_LINTING_TYPING_TESTS" - value: "false" + value: "test_false" } From 224a3dad36e4c332348383039ad51b618d8ff682 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Tue, 2 Apr 2024 14:51:23 -0400 Subject: [PATCH 15/15] Update .kokoro/presubmit/presubmit.cfg --- .kokoro/presubmit/presubmit.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/presubmit/presubmit.cfg b/.kokoro/presubmit/presubmit.cfg index fb65d4fdf..fa39b1118 100644 --- a/.kokoro/presubmit/presubmit.cfg +++ b/.kokoro/presubmit/presubmit.cfg @@ -11,5 +11,5 @@ env_vars: { } env_vars: { key: "RUN_LINTING_TYPING_TESTS" - value: "test_false" + value: "false" }