From 8c943af464c8ec811b5a80e8f65c239452fe04bc Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Thu, 9 May 2024 20:26:58 +0000 Subject: [PATCH 01/16] add new presubmit for test purposes --- .kokoro/presubmit/presubmit-2.cfg | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .kokoro/presubmit/presubmit-2.cfg diff --git a/.kokoro/presubmit/presubmit-2.cfg b/.kokoro/presubmit/presubmit-2.cfg new file mode 100644 index 000000000..d4c76e719 --- /dev/null +++ b/.kokoro/presubmit/presubmit-2.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Only run these nox sessions. +env_vars: { + key: "NOX_SESSION" + value: "unit_noextras-3.12 unit-3.12 cover docs" +} From 92116c0ab8114efcfd6f8d7704b2ea80f6c896d9 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Fri, 10 May 2024 00:40:53 +0000 Subject: [PATCH 02/16] add additional sessions --- .kokoro/presubmit/presubmit-2.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/presubmit/presubmit-2.cfg b/.kokoro/presubmit/presubmit-2.cfg index d4c76e719..e7ca71cfd 100644 --- a/.kokoro/presubmit/presubmit-2.cfg +++ b/.kokoro/presubmit/presubmit-2.cfg @@ -3,5 +3,5 @@ # Only run these nox sessions. env_vars: { key: "NOX_SESSION" - value: "unit_noextras-3.12 unit-3.12 cover docs" + value: "unit_noextras-3.7 unit_noextras-3.12 unit-3.7 unit-3.8 unit-3.12 cover docs" } From 0d3444addb25daf6263938834af953b48c2c88da Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Fri, 10 May 2024 06:31:53 -0400 Subject: [PATCH 03/16] Update .kokoro/presubmit/presubmit-2.cfg --- .kokoro/presubmit/presubmit-2.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/presubmit/presubmit-2.cfg b/.kokoro/presubmit/presubmit-2.cfg index e7ca71cfd..61acec8da 100644 --- a/.kokoro/presubmit/presubmit-2.cfg +++ b/.kokoro/presubmit/presubmit-2.cfg @@ -3,5 +3,5 @@ # Only run these nox sessions. env_vars: { key: "NOX_SESSION" - value: "unit_noextras-3.7 unit_noextras-3.12 unit-3.7 unit-3.8 unit-3.12 cover docs" + value: "unit_noextras-3.7" # unit_noextras-3.12 unit-3.7 unit-3.8 unit-3.12 cover docs" } From 0282e1b39bf9dc8ca50dd958c1b67bb788da3365 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Fri, 10 May 2024 07:29:33 -0400 Subject: [PATCH 04/16] Update .kokoro/presubmit/presubmit-2.cfg --- .kokoro/presubmit/presubmit-2.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/presubmit/presubmit-2.cfg b/.kokoro/presubmit/presubmit-2.cfg index 61acec8da..e2e1a227c 100644 --- a/.kokoro/presubmit/presubmit-2.cfg +++ b/.kokoro/presubmit/presubmit-2.cfg @@ -3,5 +3,5 @@ # Only run these nox sessions. env_vars: { key: "NOX_SESSION" - value: "unit_noextras-3.7" # unit_noextras-3.12 unit-3.7 unit-3.8 unit-3.12 cover docs" + value: "unit_noextras-3.7 unit_noextras-3.12" # unit-3.7 unit-3.8 unit-3.12 cover docs" } From 6588e0d058eda0a35d2a8d8512e8dd8411bbf6ff Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Fri, 10 May 2024 12:57:05 +0000 Subject: [PATCH 05/16] added timer to nox sessions --- exp-time.py | 25 +++++++++++++++++++++++++ noxfile.py | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 exp-time.py diff --git a/exp-time.py b/exp-time.py new file mode 100644 index 000000000..0551c1cc4 --- /dev/null +++ b/exp-time.py @@ -0,0 +1,25 @@ +import time +from functools import wraps + +def timed(func): + """This decorator prints the execution time for the decorated function.""" + + @wraps(func) + def wrapper(*args, **kwargs): + start = time.time() + result = func(*args, **kwargs) + end = time.time() + print(f"{func.__name__} ran in {round(end - start, 2)} seconds") + #logger.debug("{} ran in {}s".format(func.__name__, round(end - start, 2))) + return result + + return wrapper + +@timed +def slow_function(): + """This is a slow-running function used as an example.""" + print("running a slow function...") + time.sleep(3.2) + print("done") + +slow_function() \ No newline at end of file diff --git a/noxfile.py b/noxfile.py index 78a9ab5b6..9c9fd61e3 100644 --- a/noxfile.py +++ b/noxfile.py @@ -56,6 +56,30 @@ "docs", ] +import time +from functools import wraps + +def timed(func): + """This decorator prints the execution time for the decorated function.""" + + @wraps(func) + def wrapper(*args, **kwargs): + print("Starting session timer") + start = time.time() + result = func(*args, **kwargs) + end = time.time() + total_seconds = round(end - start) + hours = total_seconds // 3600 # Integer division to get hours + remaining_seconds = total_seconds % 3600 # Modulo to find remaining seconds + minutes = remaining_seconds // 60 + seconds = remaining_seconds % 60 + human_time = f"{hours:}:{minutes:0>2}:{seconds:0>2}" + print(f"session ran in {total_seconds} seconds ({human_time})") + + #logger.debug("{} ran in {}s".format(func.__name__, round(end - start, 2))) + return result + + return wrapper def default(session, install_extras=True): """Default unit test session. @@ -105,6 +129,7 @@ def default(session, install_extras=True): @nox.session(python=UNIT_TEST_PYTHON_VERSIONS) +@timed def unit(session): """Run the unit test suite.""" @@ -112,6 +137,7 @@ def unit(session): @nox.session(python=[UNIT_TEST_PYTHON_VERSIONS[0], UNIT_TEST_PYTHON_VERSIONS[-1]]) +@timed def unit_noextras(session): """Run the unit test suite.""" @@ -129,6 +155,7 @@ def unit_noextras(session): @nox.session(python=DEFAULT_PYTHON_VERSION) +@timed def mypy(session): """Run type checks with mypy.""" @@ -151,6 +178,7 @@ def mypy(session): @nox.session(python=DEFAULT_PYTHON_VERSION) +@timed def pytype(session): """Run type checks with pytype.""" # An indirect dependecy attrs==21.1.0 breaks the check, and installing a less @@ -169,6 +197,7 @@ def pytype(session): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) +@timed def system(session): """Run the system test suite.""" @@ -221,6 +250,7 @@ def system(session): @nox.session(python=DEFAULT_PYTHON_VERSION) +@timed def mypy_samples(session): """Run type checks with mypy.""" @@ -260,6 +290,7 @@ def mypy_samples(session): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) +@timed def snippets(session): """Run the snippets test suite.""" @@ -299,6 +330,7 @@ def snippets(session): @nox.session(python=DEFAULT_PYTHON_VERSION) +@timed def cover(session): """Run the final coverage report. @@ -312,6 +344,7 @@ def cover(session): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) +@timed def prerelease_deps(session): """Run all tests with prerelease versions of dependencies installed. @@ -402,6 +435,7 @@ def prerelease_deps(session): @nox.session(python=DEFAULT_PYTHON_VERSION) +@timed def lint(session): """Run linters. @@ -424,6 +458,7 @@ def lint(session): @nox.session(python=DEFAULT_PYTHON_VERSION) +@timed def lint_setup_py(session): """Verify that setup.py is valid (including RST check).""" @@ -436,6 +471,7 @@ def lint_setup_py(session): @nox.session(python=DEFAULT_PYTHON_VERSION) +@timed def blacken(session): """Run black. Format code to uniform standard. @@ -450,6 +486,7 @@ def blacken(session): @nox.session(python="3.9") +@timed def docs(session): """Build the docs.""" @@ -486,6 +523,7 @@ def docs(session): @nox.session(python="3.10") +@timed def docfx(session): """Build the docfx yaml files for this library.""" From bb690fd2ca34f7d5a14f7119dbd8210ee09b695b Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Fri, 10 May 2024 08:58:16 -0400 Subject: [PATCH 06/16] Update .kokoro/presubmit/presubmit-2.cfg --- .kokoro/presubmit/presubmit-2.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/presubmit/presubmit-2.cfg b/.kokoro/presubmit/presubmit-2.cfg index e2e1a227c..e7ca71cfd 100644 --- a/.kokoro/presubmit/presubmit-2.cfg +++ b/.kokoro/presubmit/presubmit-2.cfg @@ -3,5 +3,5 @@ # Only run these nox sessions. env_vars: { key: "NOX_SESSION" - value: "unit_noextras-3.7 unit_noextras-3.12" # unit-3.7 unit-3.8 unit-3.12 cover docs" + value: "unit_noextras-3.7 unit_noextras-3.12 unit-3.7 unit-3.8 unit-3.12 cover docs" } From 936ba65d1935ec29aa62a93c5f055003a8aa9e99 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 10 May 2024 13:00:23 +0000 Subject: [PATCH 07/16] =?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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/noxfile.py b/noxfile.py index 9c9fd61e3..f67837369 100644 --- a/noxfile.py +++ b/noxfile.py @@ -59,6 +59,7 @@ import time from functools import wraps + def timed(func): """This decorator prints the execution time for the decorated function.""" @@ -69,18 +70,19 @@ def wrapper(*args, **kwargs): result = func(*args, **kwargs) end = time.time() total_seconds = round(end - start) - hours = total_seconds // 3600 # Integer division to get hours + hours = total_seconds // 3600 # Integer division to get hours remaining_seconds = total_seconds % 3600 # Modulo to find remaining seconds minutes = remaining_seconds // 60 seconds = remaining_seconds % 60 human_time = f"{hours:}:{minutes:0>2}:{seconds:0>2}" print(f"session ran in {total_seconds} seconds ({human_time})") - #logger.debug("{} ran in {}s".format(func.__name__, round(end - start, 2))) + # logger.debug("{} ran in {}s".format(func.__name__, round(end - start, 2))) return result return wrapper + def default(session, install_extras=True): """Default unit test session. From 839ee1b01914e645f0468f1381bbe3de10ffed70 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 10 May 2024 13:00:32 +0000 Subject: [PATCH 08/16] =?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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/noxfile.py b/noxfile.py index 9c9fd61e3..f67837369 100644 --- a/noxfile.py +++ b/noxfile.py @@ -59,6 +59,7 @@ import time from functools import wraps + def timed(func): """This decorator prints the execution time for the decorated function.""" @@ -69,18 +70,19 @@ def wrapper(*args, **kwargs): result = func(*args, **kwargs) end = time.time() total_seconds = round(end - start) - hours = total_seconds // 3600 # Integer division to get hours + hours = total_seconds // 3600 # Integer division to get hours remaining_seconds = total_seconds % 3600 # Modulo to find remaining seconds minutes = remaining_seconds // 60 seconds = remaining_seconds % 60 human_time = f"{hours:}:{minutes:0>2}:{seconds:0>2}" print(f"session ran in {total_seconds} seconds ({human_time})") - #logger.debug("{} ran in {}s".format(func.__name__, round(end - start, 2))) + # logger.debug("{} ran in {}s".format(func.__name__, round(end - start, 2))) return result return wrapper + def default(session, install_extras=True): """Default unit test session. From 6177f097c49d198ab48089d504bc29874d811748 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Mon, 13 May 2024 13:35:51 +0000 Subject: [PATCH 09/16] removes references to most environment variables --- exp-time.py | 25 ------------------------- noxfile.py | 32 ++++++++++++++++---------------- 2 files changed, 16 insertions(+), 41 deletions(-) delete mode 100644 exp-time.py diff --git a/exp-time.py b/exp-time.py deleted file mode 100644 index 0551c1cc4..000000000 --- a/exp-time.py +++ /dev/null @@ -1,25 +0,0 @@ -import time -from functools import wraps - -def timed(func): - """This decorator prints the execution time for the decorated function.""" - - @wraps(func) - def wrapper(*args, **kwargs): - start = time.time() - result = func(*args, **kwargs) - end = time.time() - print(f"{func.__name__} ran in {round(end - start, 2)} seconds") - #logger.debug("{} ran in {}s".format(func.__name__, round(end - start, 2))) - return result - - return wrapper - -@timed -def slow_function(): - """This is a slow-running function used as an example.""" - print("running a slow function...") - time.sleep(3.2) - print("done") - -slow_function() \ No newline at end of file diff --git a/noxfile.py b/noxfile.py index f67837369..2bbc360f2 100644 --- a/noxfile.py +++ b/noxfile.py @@ -162,8 +162,8 @@ def mypy(session): """Run type checks with mypy.""" # 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") + # 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) @@ -188,8 +188,8 @@ def pytype(session): # https://github.com/googleapis/python-bigquery/issues/655 # 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") + # 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]") @@ -208,8 +208,8 @@ def system(session): ) # Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true. - if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false": - session.skip("RUN_SYSTEM_TESTS is set to false, skipping") + # if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false": + # 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", ""): @@ -257,8 +257,8 @@ def mypy_samples(session): """Run type checks with mypy.""" # 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") + # 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"): @@ -297,8 +297,8 @@ def snippets(session): """Run the snippets test suite.""" # Check the value of `RUN_SNIPPETS_TESTS` env var. It defaults to true. - if os.environ.get("RUN_SNIPPETS_TESTS", "true") == "false": - session.skip("RUN_SNIPPETS_TESTS is set to false, skipping") + # if os.environ.get("RUN_SNIPPETS_TESTS", "true") == "false": + # session.skip("RUN_SNIPPETS_TESTS is set to false, skipping") constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" @@ -446,8 +446,8 @@ def lint(session): """ # 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") + # 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", ".") @@ -465,8 +465,8 @@ def lint_setup_py(session): """Verify that setup.py is valid (including RST check).""" # 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") + # 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") @@ -480,8 +480,8 @@ def blacken(session): """ # 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") + # 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 05014ce2e33214ef57687a07ad3f94ba2dcef922 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Mon, 13 May 2024 16:22:25 +0000 Subject: [PATCH 10/16] testing the use of base names for the nox sessions --- .kokoro/presubmit/presubmit-2.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/presubmit/presubmit-2.cfg b/.kokoro/presubmit/presubmit-2.cfg index e7ca71cfd..8525f1a96 100644 --- a/.kokoro/presubmit/presubmit-2.cfg +++ b/.kokoro/presubmit/presubmit-2.cfg @@ -3,5 +3,5 @@ # Only run these nox sessions. env_vars: { key: "NOX_SESSION" - value: "unit_noextras-3.7 unit_noextras-3.12 unit-3.7 unit-3.8 unit-3.12 cover docs" + value: "unit_noextras unit cover docs" } From b84504a88b1ca90d3667aacef2ab54f4caf62739 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Mon, 13 May 2024 17:09:28 +0000 Subject: [PATCH 11/16] removes references to unneeded linting and typing env variables --- noxfile.py | 55 ++++-------------------------------------------------- 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/noxfile.py b/noxfile.py index 2bbc360f2..b66a225e8 100644 --- a/noxfile.py +++ b/noxfile.py @@ -60,29 +60,6 @@ from functools import wraps -def timed(func): - """This decorator prints the execution time for the decorated function.""" - - @wraps(func) - def wrapper(*args, **kwargs): - print("Starting session timer") - start = time.time() - result = func(*args, **kwargs) - end = time.time() - total_seconds = round(end - start) - hours = total_seconds // 3600 # Integer division to get hours - remaining_seconds = total_seconds % 3600 # Modulo to find remaining seconds - minutes = remaining_seconds // 60 - seconds = remaining_seconds % 60 - human_time = f"{hours:}:{minutes:0>2}:{seconds:0>2}" - print(f"session ran in {total_seconds} seconds ({human_time})") - - # logger.debug("{} ran in {}s".format(func.__name__, round(end - start, 2))) - return result - - return wrapper - - def default(session, install_extras=True): """Default unit test session. @@ -161,10 +138,6 @@ def unit_noextras(session): def mypy(session): """Run type checks with mypy.""" - # 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") - session.install("-e", ".[all]") session.install(MYPY_VERSION) @@ -187,10 +160,6 @@ 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_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") - session.install("attrs==20.3.0") session.install("-e", ".[all]") session.install(PYTYPE_VERSION) @@ -208,8 +177,8 @@ def system(session): ) # Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true. - # if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false": - # session.skip("RUN_SYSTEM_TESTS is set to false, skipping") + if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false": + 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", ""): @@ -256,10 +225,6 @@ def system(session): def mypy_samples(session): """Run type checks with mypy.""" - # 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") - session.install("pytest") for requirements_path in CURRENT_DIRECTORY.glob("samples/*/requirements.txt"): session.install("-r", str(requirements_path)) @@ -297,8 +262,8 @@ def snippets(session): """Run the snippets test suite.""" # Check the value of `RUN_SNIPPETS_TESTS` env var. It defaults to true. - # if os.environ.get("RUN_SNIPPETS_TESTS", "true") == "false": - # session.skip("RUN_SNIPPETS_TESTS is set to false, skipping") + if os.environ.get("RUN_SNIPPETS_TESTS", "true") == "false": + session.skip("RUN_SNIPPETS_TESTS is set to false, skipping") constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" @@ -445,10 +410,6 @@ def lint(session): serious code quality issues. """ - # 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") - session.install("flake8", BLACK_VERSION) session.install("-e", ".") session.run("flake8", os.path.join("google", "cloud", "bigquery")) @@ -464,10 +425,6 @@ def lint(session): def lint_setup_py(session): """Verify that setup.py is valid (including RST check).""" - # 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") - session.install("docutils", "Pygments") session.run("python", "setup.py", "check", "--restructuredtext", "--strict") @@ -479,10 +436,6 @@ def blacken(session): Format code to uniform standard. """ - # 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") - session.install(BLACK_VERSION) session.run("black", *BLACK_PATHS) From 0dd852a22d710ecb1d8e449dad649e1f4d3238bb Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Mon, 13 May 2024 17:13:29 +0000 Subject: [PATCH 12/16] change file name and update env_vars in presubmit-2 --- .kokoro/presubmit/presubmit-2.cfg | 8 ++++++++ .kokoro/presubmit/{presubmit.cfg => presubmit.bak} | 0 2 files changed, 8 insertions(+) rename .kokoro/presubmit/{presubmit.cfg => presubmit.bak} (100%) diff --git a/.kokoro/presubmit/presubmit-2.cfg b/.kokoro/presubmit/presubmit-2.cfg index 8525f1a96..4f582c1ae 100644 --- a/.kokoro/presubmit/presubmit-2.cfg +++ b/.kokoro/presubmit/presubmit-2.cfg @@ -1,6 +1,14 @@ # Format: //devtools/kokoro/config/proto/build.proto # Only run these nox sessions. +env_vars: { + key: "RUN_SYSTEM_TESTS" + value: "false" +} +env_vars: { + key: "RUN_SNIPPETS_TESTS" + value: "false" +} env_vars: { key: "NOX_SESSION" value: "unit_noextras unit cover docs" diff --git a/.kokoro/presubmit/presubmit.cfg b/.kokoro/presubmit/presubmit.bak similarity index 100% rename from .kokoro/presubmit/presubmit.cfg rename to .kokoro/presubmit/presubmit.bak From e7a10f4c32c4865ee50ea6e2c97f56331ac0c570 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Mon, 13 May 2024 17:15:33 +0000 Subject: [PATCH 13/16] remove timed decorators --- noxfile.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/noxfile.py b/noxfile.py index b66a225e8..43255b40c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -108,7 +108,6 @@ def default(session, install_extras=True): @nox.session(python=UNIT_TEST_PYTHON_VERSIONS) -@timed def unit(session): """Run the unit test suite.""" @@ -116,7 +115,6 @@ def unit(session): @nox.session(python=[UNIT_TEST_PYTHON_VERSIONS[0], UNIT_TEST_PYTHON_VERSIONS[-1]]) -@timed def unit_noextras(session): """Run the unit test suite.""" @@ -134,7 +132,6 @@ def unit_noextras(session): @nox.session(python=DEFAULT_PYTHON_VERSION) -@timed def mypy(session): """Run type checks with mypy.""" @@ -153,7 +150,6 @@ def mypy(session): @nox.session(python=DEFAULT_PYTHON_VERSION) -@timed def pytype(session): """Run type checks with pytype.""" # An indirect dependecy attrs==21.1.0 breaks the check, and installing a less @@ -168,7 +164,6 @@ def pytype(session): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) -@timed def system(session): """Run the system test suite.""" @@ -221,7 +216,6 @@ def system(session): @nox.session(python=DEFAULT_PYTHON_VERSION) -@timed def mypy_samples(session): """Run type checks with mypy.""" @@ -257,7 +251,6 @@ def mypy_samples(session): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) -@timed def snippets(session): """Run the snippets test suite.""" @@ -297,7 +290,6 @@ def snippets(session): @nox.session(python=DEFAULT_PYTHON_VERSION) -@timed def cover(session): """Run the final coverage report. @@ -311,7 +303,6 @@ def cover(session): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) -@timed def prerelease_deps(session): """Run all tests with prerelease versions of dependencies installed. @@ -402,7 +393,6 @@ def prerelease_deps(session): @nox.session(python=DEFAULT_PYTHON_VERSION) -@timed def lint(session): """Run linters. @@ -421,7 +411,6 @@ def lint(session): @nox.session(python=DEFAULT_PYTHON_VERSION) -@timed def lint_setup_py(session): """Verify that setup.py is valid (including RST check).""" @@ -430,7 +419,6 @@ def lint_setup_py(session): @nox.session(python=DEFAULT_PYTHON_VERSION) -@timed def blacken(session): """Run black. Format code to uniform standard. @@ -441,7 +429,6 @@ def blacken(session): @nox.session(python="3.9") -@timed def docs(session): """Build the docs.""" @@ -478,7 +465,6 @@ def docs(session): @nox.session(python="3.10") -@timed def docfx(session): """Build the docfx yaml files for this library.""" From 204aa2c7c41da9022142eeb85e312770e450b318 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Mon, 13 May 2024 20:03:25 +0000 Subject: [PATCH 14/16] revert several files --- .kokoro/presubmit/presubmit-2.cfg | 8 -------- .kokoro/presubmit/{presubmit.bak => presubmit.cfg} | 0 2 files changed, 8 deletions(-) rename .kokoro/presubmit/{presubmit.bak => presubmit.cfg} (100%) diff --git a/.kokoro/presubmit/presubmit-2.cfg b/.kokoro/presubmit/presubmit-2.cfg index 4f582c1ae..8525f1a96 100644 --- a/.kokoro/presubmit/presubmit-2.cfg +++ b/.kokoro/presubmit/presubmit-2.cfg @@ -1,14 +1,6 @@ # Format: //devtools/kokoro/config/proto/build.proto # Only run these nox sessions. -env_vars: { - key: "RUN_SYSTEM_TESTS" - value: "false" -} -env_vars: { - key: "RUN_SNIPPETS_TESTS" - value: "false" -} env_vars: { key: "NOX_SESSION" value: "unit_noextras unit cover docs" diff --git a/.kokoro/presubmit/presubmit.bak b/.kokoro/presubmit/presubmit.cfg similarity index 100% rename from .kokoro/presubmit/presubmit.bak rename to .kokoro/presubmit/presubmit.cfg From 45af71385c1c06e840e859ed8555404756aeb4fe Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Tue, 14 May 2024 07:34:41 -0400 Subject: [PATCH 15/16] Update noxfile.py --- noxfile.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index 43255b40c..c6aad2b8f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -56,9 +56,6 @@ "docs", ] -import time -from functools import wraps - def default(session, install_extras=True): """Default unit test session. From a91de8c71a09822eb721a307c0f0b3e4cf61a67c Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 14 May 2024 12:43:07 +0000 Subject: [PATCH 16/16] remove test, remove unneeded vars, etc --- .kokoro/presubmit/presubmit-2.cfg | 7 ------- .kokoro/presubmit/presubmit.cfg | 12 ++---------- noxfile.py | 8 -------- 3 files changed, 2 insertions(+), 25 deletions(-) delete mode 100644 .kokoro/presubmit/presubmit-2.cfg diff --git a/.kokoro/presubmit/presubmit-2.cfg b/.kokoro/presubmit/presubmit-2.cfg deleted file mode 100644 index 8525f1a96..000000000 --- a/.kokoro/presubmit/presubmit-2.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Only run these nox sessions. -env_vars: { - key: "NOX_SESSION" - value: "unit_noextras unit cover docs" -} diff --git a/.kokoro/presubmit/presubmit.cfg b/.kokoro/presubmit/presubmit.cfg index fa39b1118..ce3953120 100644 --- a/.kokoro/presubmit/presubmit.cfg +++ b/.kokoro/presubmit/presubmit.cfg @@ -2,14 +2,6 @@ # Disable system tests. env_vars: { - key: "RUN_SYSTEM_TESTS" - value: "false" -} -env_vars: { - key: "RUN_SNIPPETS_TESTS" - value: "false" -} -env_vars: { - key: "RUN_LINTING_TYPING_TESTS" - value: "false" + key: "NOX_SESSION" + value: "unit_noextras unit cover docs" } diff --git a/noxfile.py b/noxfile.py index c6aad2b8f..02655a7b7 100644 --- a/noxfile.py +++ b/noxfile.py @@ -168,10 +168,6 @@ def system(session): CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - # Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true. - if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false": - 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", ""): session.skip("Credentials must be set via environment variable.") @@ -251,10 +247,6 @@ def mypy_samples(session): def snippets(session): """Run the snippets test suite.""" - # Check the value of `RUN_SNIPPETS_TESTS` env var. It defaults to true. - if os.environ.get("RUN_SNIPPETS_TESTS", "true") == "false": - session.skip("RUN_SNIPPETS_TESTS is set to false, skipping") - constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" )