[go: up one dir, main page]

Skip to content

Commit

Permalink
fix: creates linting-typing.cfg in presubmit (#1881)
Browse files Browse the repository at this point in the history
* creates linting-typing.cfg in presubmit

* attempt to filter out linting and typing tests from presubmit

* lints and blackens this commit

* revise environmental variables

* Update noxfile.py

* Update noxfile.py

* Update noxfile.py

* Update noxfile.py

* Update noxfile.py

* Update noxfile.py

* Update .kokoro/presubmit/linting-typing.cfg

* Update .kokoro/presubmit/linting-typing.cfg

* Update .kokoro/presubmit/linting-typing.cfg

* Update .kokoro/presubmit/presubmit.cfg

* Update .kokoro/presubmit/presubmit.cfg
  • Loading branch information
chalmerlowe committed Apr 3, 2024
1 parent a4bb562 commit c852c15
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .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"
}
4 changes: 4 additions & 0 deletions .kokoro/presubmit/presubmit.cfg
Expand Up @@ -9,3 +9,7 @@ env_vars: {
key: "RUN_SNIPPETS_TESTS"
value: "false"
}
env_vars: {
key: "RUN_LINTING_TYPING_TESTS"
value: "false"
}
24 changes: 24 additions & 0 deletions noxfile.py
Expand Up @@ -132,6 +132,10 @@ 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 @@ -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_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 Down Expand Up @@ -213,6 +221,10 @@ 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 @@ -394,6 +406,10 @@ 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 @@ -408,6 +424,10 @@ 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 @@ -418,6 +438,10 @@ 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 c852c15

Please sign in to comment.