Skip to content

Commit c852c15

Browse files
authored
fix: creates linting-typing.cfg in presubmit (#1881)
* 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
1 parent a4bb562 commit c852c15

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

.kokoro/presubmit/linting-typing.cfg

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Only run these nox sessions.
4+
env_vars: {
5+
key: "NOX_SESSION"
6+
value: "lint lint_setup_py blacken mypy mypy_samples pytype"
7+
}

.kokoro/presubmit/presubmit.cfg

+4
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ env_vars: {
99
key: "RUN_SNIPPETS_TESTS"
1010
value: "false"
1111
}
12+
env_vars: {
13+
key: "RUN_LINTING_TYPING_TESTS"
14+
value: "false"
15+
}

noxfile.py

+24
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ def unit_noextras(session):
132132
def mypy(session):
133133
"""Run type checks with mypy."""
134134

135+
# Check the value of `RUN_LINTING_TYPING_TESTS` env var. It defaults to true.
136+
if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false":
137+
session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping")
138+
135139
session.install("-e", ".[all]")
136140
session.install(MYPY_VERSION)
137141

@@ -153,6 +157,10 @@ def pytype(session):
153157
# recent version avoids the error until a possibly better fix is found.
154158
# https://github.com/googleapis/python-bigquery/issues/655
155159

160+
# Check the value of `RUN_LINTING_TYPING_TESTS` env var. It defaults to true.
161+
if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false":
162+
session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping")
163+
156164
session.install("attrs==20.3.0")
157165
session.install("-e", ".[all]")
158166
session.install(PYTYPE_VERSION)
@@ -213,6 +221,10 @@ def system(session):
213221
def mypy_samples(session):
214222
"""Run type checks with mypy."""
215223

224+
# Check the value of `RUN_LINTING_TYPING_TESTS` env var. It defaults to true.
225+
if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false":
226+
session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping")
227+
216228
session.install("pytest")
217229
for requirements_path in CURRENT_DIRECTORY.glob("samples/*/requirements.txt"):
218230
session.install("-r", str(requirements_path))
@@ -394,6 +406,10 @@ def lint(session):
394406
serious code quality issues.
395407
"""
396408

409+
# Check the value of `RUN_LINTING_TYPING_TESTS` env var. It defaults to true.
410+
if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false":
411+
session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping")
412+
397413
session.install("flake8", BLACK_VERSION)
398414
session.install("-e", ".")
399415
session.run("flake8", os.path.join("google", "cloud", "bigquery"))
@@ -408,6 +424,10 @@ def lint(session):
408424
def lint_setup_py(session):
409425
"""Verify that setup.py is valid (including RST check)."""
410426

427+
# Check the value of `RUN_LINTING_TYPING_TESTS` env var. It defaults to true.
428+
if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false":
429+
session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping")
430+
411431
session.install("docutils", "Pygments")
412432
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
413433

@@ -418,6 +438,10 @@ def blacken(session):
418438
Format code to uniform standard.
419439
"""
420440

441+
# Check the value of `RUN_LINTING_TYPING_TESTS` env var. It defaults to true.
442+
if os.environ.get("RUN_LINTING_TYPING_TESTS", "true") == "false":
443+
session.skip("RUN_LINTING_TYPING_TESTS is set to false, skipping")
444+
421445
session.install(BLACK_VERSION)
422446
session.run("black", *BLACK_PATHS)
423447

0 commit comments

Comments
 (0)