Skip to content

Commit

Permalink
fix: edit presubmit for to simplify configuration (#1915)
Browse files Browse the repository at this point in the history
* add new presubmit for test purposes

* add additional sessions

* Update .kokoro/presubmit/presubmit-2.cfg

* Update .kokoro/presubmit/presubmit-2.cfg

* added timer to nox sessions

* Update .kokoro/presubmit/presubmit-2.cfg

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* removes references to most environment variables

* testing the use of base names for the nox sessions

* removes references to unneeded linting and typing env variables

* change file name and update env_vars in presubmit-2

* remove timed decorators

* revert several files

* Update noxfile.py

* remove test, remove unneeded vars, etc

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
chalmerlowe and gcf-owl-bot[bot] committed May 15, 2024
1 parent a86d7b9 commit b739596
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 42 deletions.
12 changes: 2 additions & 10 deletions .kokoro/presubmit/presubmit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
32 changes: 0 additions & 32 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,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)

Expand All @@ -157,10 +153,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)
Expand All @@ -176,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.")
Expand Down Expand Up @@ -224,10 +212,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))
Expand Down Expand Up @@ -263,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"
)
Expand Down Expand Up @@ -409,10 +389,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"))
Expand All @@ -427,10 +403,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")

Expand All @@ -441,10 +413,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)

Expand Down

0 comments on commit b739596

Please sign in to comment.