We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Pin black to specific version
New releases of `black` can change the way the code is formatted ("blackened"), causing the CI checks to fail. We should thus use a deterministic version of `black`.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `noxfile.py`
Content:
```
1 # Copyright 2016 Google LLC
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 from __future__ import absolute_import
16 
17 import os
18 import shutil
19 
20 import nox
21 
22 
23 BLACK_PATHS = ("docs", "google", "samples", "tests", "noxfile.py", "setup.py")
24 
25 
26 def default(session):
27     """Default unit test session.
28 
29     This is intended to be run **without** an interpreter set, so
30     that the current ``python`` (on the ``PATH``) or the version of
31     Python corresponding to the ``nox`` binary the ``PATH`` can
32     run the tests.
33     """
34     # Install all test dependencies, then install local packages in-place.
35     session.install(
36         "mock", "pytest", "google-cloud-testutils", "pytest-cov", "freezegun"
37     )
38     session.install("grpcio")
39 
40     # fastparquet is not included in .[all] because, in general, it's redundant
41     # with pyarrow. We still want to run some unit tests with fastparquet
42     # serialization, though.
43     session.install("-e", ".[all,fastparquet]")
44 
45     # IPython does not support Python 2 after version 5.x
46     if session.python == "2.7":
47         session.install("ipython==5.5")
48     else:
49         session.install("ipython")
50 
51     # opentelemetry was not added to [all] because opentelemetry does not support Python 2.
52     # Exporter does not need to be in nox thus it has been added to README documentation
53     if session.python != "2.7":
54         session.install("-e", ".[opentelemetry]")
55 
56     # Run py.test against the unit tests.
57     session.run(
58         "py.test",
59         "--quiet",
60         "--cov=google.cloud.bigquery",
61         "--cov=tests.unit",
62         "--cov-append",
63         "--cov-config=.coveragerc",
64         "--cov-report=",
65         "--cov-fail-under=0",
66         os.path.join("tests", "unit"),
67         *session.posargs,
68     )
69 
70 
71 @nox.session(python=["2.7", "3.5", "3.6", "3.7", "3.8"])
72 def unit(session):
73     """Run the unit test suite."""
74     default(session)
75 
76 
77 @nox.session(python=["2.7", "3.8"])
78 def system(session):
79     """Run the system test suite."""
80 
81     # Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true.
82     if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false":
83         session.skip("RUN_SYSTEM_TESTS is set to false, skipping")
84 
85     # Sanity check: Only run system tests if the environment variable is set.
86     if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
87         session.skip("Credentials must be set via environment variable.")
88 
89     # Use pre-release gRPC for system tests.
90     session.install("--pre", "grpcio")
91 
92     # Install all test dependencies, then install local packages in place.
93     session.install("mock", "pytest", "psutil", "google-cloud-testutils")
94     session.install("google-cloud-storage")
95     session.install("-e", ".[all]")
96 
97     # IPython does not support Python 2 after version 5.x
98     if session.python == "2.7":
99         session.install("ipython==5.5")
100     else:
101         session.install("ipython")
102 
103     # Run py.test against the system tests.
104     session.run(
105         "py.test", "--quiet", os.path.join("tests", "system.py"), *session.posargs
106     )
107 
108 
109 @nox.session(python=["2.7", "3.8"])
110 def snippets(session):
111     """Run the snippets test suite."""
112 
113     # Sanity check: Only run snippets tests if the environment variable is set.
114     if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
115         session.skip("Credentials must be set via environment variable.")
116 
117     # Install all test dependencies, then install local packages in place.
118     session.install("mock", "pytest", "google-cloud-testutils")
119     session.install("google-cloud-storage")
120     session.install("grpcio")
121     session.install("-e", ".[all]")
122 
123     # Run py.test against the snippets tests.
124     # Skip tests in samples/snippets, as those are run in a different session
125     # using the nox config from that directory.
126     session.run("py.test", os.path.join("docs", "snippets.py"), *session.posargs)
127     session.run("py.test", "samples", "--ignore=samples/snippets", *session.posargs)
128 
129 
130 @nox.session(python="3.8")
131 def cover(session):
132     """Run the final coverage report.
133 
134     This outputs the coverage report aggregating coverage from the unit
135     test runs (not system test runs), and then erases coverage data.
136     """
137     session.install("coverage", "pytest-cov")
138     session.run("coverage", "report", "--show-missing", "--fail-under=100")
139     session.run("coverage", "erase")
140 
141 
142 @nox.session(python="3.8")
143 def lint(session):
144     """Run linters.
145 
146     Returns a failure if the linters find linting errors or sufficiently
147     serious code quality issues.
148     """
149 
150     session.install("black", "flake8")
151     session.install("-e", ".")
152     session.run("flake8", os.path.join("google", "cloud", "bigquery"))
153     session.run("flake8", "tests")
154     session.run("flake8", os.path.join("docs", "samples"))
155     session.run("flake8", os.path.join("docs", "snippets.py"))
156     session.run("black", "--check", *BLACK_PATHS)
157 
158 
159 @nox.session(python="3.8")
160 def lint_setup_py(session):
161     """Verify that setup.py is valid (including RST check)."""
162 
163     session.install("docutils", "Pygments")
164     session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
165 
166 
167 @nox.session(python="3.6")
168 def blacken(session):
169     """Run black.
170     Format code to uniform standard.
171 
172     This currently uses Python 3.6 due to the automated Kokoro run of synthtool.
173     That run uses an image that doesn't have 3.6 installed. Before updating this
174     check the state of the `gcp_ubuntu_config` we use for that Kokoro run.
175     """
176     session.install("black")
177     session.run("black", *BLACK_PATHS)
178 
179 
180 @nox.session(python="3.8")
181 def docs(session):
182     """Build the docs."""
183 
184     session.install("ipython", "recommonmark", "sphinx", "sphinx_rtd_theme")
185     session.install("google-cloud-storage")
186     session.install("-e", ".[all]")
187 
188     shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
189     session.run(
190         "sphinx-build",
191         "-W",  # warnings as errors
192         "-T",  # show full traceback on exception
193         "-N",  # no colors
194         "-b",
195         "html",
196         "-d",
197         os.path.join("docs", "_build", "doctrees", ""),
198         os.path.join("docs", ""),
199         os.path.join("docs", "_build", "html", ""),
200     )
201 
202 
203 @nox.session(python="3.8")
204 def docfx(session):
205     """Build the docfx yaml files for this library."""
206 
207     session.install("-e", ".")
208     session.install("sphinx", "alabaster", "recommonmark", "sphinx-docfx-yaml")
209 
210     shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
211     session.run(
212         "sphinx-build",
213         "-T",  # show full traceback on exception
214         "-N",  # no colors
215         "-D",
216         (
217             "extensions=sphinx.ext.autodoc,"
218             "sphinx.ext.autosummary,"
219             "docfx_yaml.extension,"
220             "sphinx.ext.intersphinx,"
221             "sphinx.ext.coverage,"
222             "sphinx.ext.napoleon,"
223             "sphinx.ext.todo,"
224             "sphinx.ext.viewcode,"
225             "recommonmark"
226         ),
227         "-b",
228         "html",
229         "-d",
230         os.path.join("docs", "_build", "doctrees", ""),
231         os.path.join("docs", ""),
232         os.path.join("docs", "_build", "html", ""),
233     )
234
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/noxfile.py b/noxfile.py
--- a/noxfile.py
+++ b/noxfile.py
@@ -20,6 +20,7 @@
 import nox
 
 
+BLACK_VERSION = "black==19.10b0"
 BLACK_PATHS = ("docs", "google", "samples", "tests", "noxfile.py", "setup.py")
 
 
@@ -147,7 +148,7 @@
     serious code quality issues.
     """
 
-    session.install("black", "flake8")
+    session.install("flake8", BLACK_VERSION)
     session.install("-e", ".")
     session.run("flake8", os.path.join("google", "cloud", "bigquery"))
     session.run("flake8", "tests")
@@ -173,7 +174,7 @@
     That run uses an image that doesn't have 3.6 installed. Before updating this
     check the state of the `gcp_ubuntu_config` we use for that Kokoro run.
     """
-    session.install("black")
+    session.install(BLACK_VERSION)
     session.run("black", *BLACK_PATHS)

{"golden_diff": "diff --git a/noxfile.py b/noxfile.py\n--- a/noxfile.py\n+++ b/noxfile.py\n@@ -20,6 +20,7 @@\n import nox\n \n \n+BLACK_VERSION = \"black==19.10b0\"\n BLACK_PATHS = (\"docs\", \"google\", \"samples\", \"tests\", \"noxfile.py\", \"setup.py\")\n \n \n@@ -147,7 +148,7 @@\n     serious code quality issues.\n     \"\"\"\n \n-    session.install(\"black\", \"flake8\")\n+    session.install(\"flake8\", BLACK_VERSION)\n     session.install(\"-e\", \".\")\n     session.run(\"flake8\", os.path.join(\"google\", \"cloud\", \"bigquery\"))\n     session.run(\"flake8\", \"tests\")\n@@ -173,7 +174,7 @@\n     That run uses an image that doesn't have 3.6 installed. Before updating this\n     check the state of the `gcp_ubuntu_config` we use for that Kokoro run.\n     \"\"\"\n-    session.install(\"black\")\n+    session.install(BLACK_VERSION)\n     session.run(\"black\", *BLACK_PATHS)\n", "issue": "Pin black to specific version\nNew releases of `black` can change the way the code is formatted (\"blackened\"), causing the CI checks to fail. We should thus use a deterministic version of `black`.\n", "before_files": [{"content": "# Copyright 2016 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import absolute_import\n\nimport os\nimport shutil\n\nimport nox\n\n\nBLACK_PATHS = (\"docs\", \"google\", \"samples\", \"tests\", \"noxfile.py\", \"setup.py\")\n\n\ndef default(session):\n    \"\"\"Default unit test session.\n\n    This is intended to be run **without** an interpreter set, so\n    that the current ``python`` (on the ``PATH``) or the version of\n    Python corresponding to the ``nox`` binary the ``PATH`` can\n    run the tests.\n    \"\"\"\n    # Install all test dependencies, then install local packages in-place.\n    session.install(\n        \"mock\", \"pytest\", \"google-cloud-testutils\", \"pytest-cov\", \"freezegun\"\n    )\n    session.install(\"grpcio\")\n\n    # fastparquet is not included in .[all] because, in general, it's redundant\n    # with pyarrow. We still want to run some unit tests with fastparquet\n    # serialization, though.\n    session.install(\"-e\", \".[all,fastparquet]\")\n\n    # IPython does not support Python 2 after version 5.x\n    if session.python == \"2.7\":\n        session.install(\"ipython==5.5\")\n    else:\n        session.install(\"ipython\")\n\n    # opentelemetry was not added to [all] because opentelemetry does not support Python 2.\n    # Exporter does not need to be in nox thus it has been added to README documentation\n    if session.python != \"2.7\":\n        session.install(\"-e\", \".[opentelemetry]\")\n\n    # Run py.test against the unit tests.\n    session.run(\n        \"py.test\",\n        \"--quiet\",\n        \"--cov=google.cloud.bigquery\",\n        \"--cov=tests.unit\",\n        \"--cov-append\",\n        \"--cov-config=.coveragerc\",\n        \"--cov-report=\",\n        \"--cov-fail-under=0\",\n        os.path.join(\"tests\", \"unit\"),\n        *session.posargs,\n    )\n\n\n@nox.session(python=[\"2.7\", \"3.5\", \"3.6\", \"3.7\", \"3.8\"])\ndef unit(session):\n    \"\"\"Run the unit test suite.\"\"\"\n    default(session)\n\n\n@nox.session(python=[\"2.7\", \"3.8\"])\ndef system(session):\n    \"\"\"Run the system test suite.\"\"\"\n\n    # Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true.\n    if os.environ.get(\"RUN_SYSTEM_TESTS\", \"true\") == \"false\":\n        session.skip(\"RUN_SYSTEM_TESTS is set to false, skipping\")\n\n    # Sanity check: Only run system tests if the environment variable is set.\n    if not os.environ.get(\"GOOGLE_APPLICATION_CREDENTIALS\", \"\"):\n        session.skip(\"Credentials must be set via environment variable.\")\n\n    # Use pre-release gRPC for system tests.\n    session.install(\"--pre\", \"grpcio\")\n\n    # Install all test dependencies, then install local packages in place.\n    session.install(\"mock\", \"pytest\", \"psutil\", \"google-cloud-testutils\")\n    session.install(\"google-cloud-storage\")\n    session.install(\"-e\", \".[all]\")\n\n    # IPython does not support Python 2 after version 5.x\n    if session.python == \"2.7\":\n        session.install(\"ipython==5.5\")\n    else:\n        session.install(\"ipython\")\n\n    # Run py.test against the system tests.\n    session.run(\n        \"py.test\", \"--quiet\", os.path.join(\"tests\", \"system.py\"), *session.posargs\n    )\n\n\n@nox.session(python=[\"2.7\", \"3.8\"])\ndef snippets(session):\n    \"\"\"Run the snippets test suite.\"\"\"\n\n    # Sanity check: Only run snippets tests if the environment variable is set.\n    if not os.environ.get(\"GOOGLE_APPLICATION_CREDENTIALS\", \"\"):\n        session.skip(\"Credentials must be set via environment variable.\")\n\n    # Install all test dependencies, then install local packages in place.\n    session.install(\"mock\", \"pytest\", \"google-cloud-testutils\")\n    session.install(\"google-cloud-storage\")\n    session.install(\"grpcio\")\n    session.install(\"-e\", \".[all]\")\n\n    # Run py.test against the snippets tests.\n    # Skip tests in samples/snippets, as those are run in a different session\n    # using the nox config from that directory.\n    session.run(\"py.test\", os.path.join(\"docs\", \"snippets.py\"), *session.posargs)\n    session.run(\"py.test\", \"samples\", \"--ignore=samples/snippets\", *session.posargs)\n\n\n@nox.session(python=\"3.8\")\ndef cover(session):\n    \"\"\"Run the final coverage report.\n\n    This outputs the coverage report aggregating coverage from the unit\n    test runs (not system test runs), and then erases coverage data.\n    \"\"\"\n    session.install(\"coverage\", \"pytest-cov\")\n    session.run(\"coverage\", \"report\", \"--show-missing\", \"--fail-under=100\")\n    session.run(\"coverage\", \"erase\")\n\n\n@nox.session(python=\"3.8\")\ndef lint(session):\n    \"\"\"Run linters.\n\n    Returns a failure if the linters find linting errors or sufficiently\n    serious code quality issues.\n    \"\"\"\n\n    session.install(\"black\", \"flake8\")\n    session.install(\"-e\", \".\")\n    session.run(\"flake8\", os.path.join(\"google\", \"cloud\", \"bigquery\"))\n    session.run(\"flake8\", \"tests\")\n    session.run(\"flake8\", os.path.join(\"docs\", \"samples\"))\n    session.run(\"flake8\", os.path.join(\"docs\", \"snippets.py\"))\n    session.run(\"black\", \"--check\", *BLACK_PATHS)\n\n\n@nox.session(python=\"3.8\")\ndef lint_setup_py(session):\n    \"\"\"Verify that setup.py is valid (including RST check).\"\"\"\n\n    session.install(\"docutils\", \"Pygments\")\n    session.run(\"python\", \"setup.py\", \"check\", \"--restructuredtext\", \"--strict\")\n\n\n@nox.session(python=\"3.6\")\ndef blacken(session):\n    \"\"\"Run black.\n    Format code to uniform standard.\n\n    This currently uses Python 3.6 due to the automated Kokoro run of synthtool.\n    That run uses an image that doesn't have 3.6 installed. Before updating this\n    check the state of the `gcp_ubuntu_config` we use for that Kokoro run.\n    \"\"\"\n    session.install(\"black\")\n    session.run(\"black\", *BLACK_PATHS)\n\n\n@nox.session(python=\"3.8\")\ndef docs(session):\n    \"\"\"Build the docs.\"\"\"\n\n    session.install(\"ipython\", \"recommonmark\", \"sphinx\", \"sphinx_rtd_theme\")\n    session.install(\"google-cloud-storage\")\n    session.install(\"-e\", \".[all]\")\n\n    shutil.rmtree(os.path.join(\"docs\", \"_build\"), ignore_errors=True)\n    session.run(\n        \"sphinx-build\",\n        \"-W\",  # warnings as errors\n        \"-T\",  # show full traceback on exception\n        \"-N\",  # no colors\n        \"-b\",\n        \"html\",\n        \"-d\",\n        os.path.join(\"docs\", \"_build\", \"doctrees\", \"\"),\n        os.path.join(\"docs\", \"\"),\n        os.path.join(\"docs\", \"_build\", \"html\", \"\"),\n    )\n\n\n@nox.session(python=\"3.8\")\ndef docfx(session):\n    \"\"\"Build the docfx yaml files for this library.\"\"\"\n\n    session.install(\"-e\", \".\")\n    session.install(\"sphinx\", \"alabaster\", \"recommonmark\", \"sphinx-docfx-yaml\")\n\n    shutil.rmtree(os.path.join(\"docs\", \"_build\"), ignore_errors=True)\n    session.run(\n        \"sphinx-build\",\n        \"-T\",  # show full traceback on exception\n        \"-N\",  # no colors\n        \"-D\",\n        (\n            \"extensions=sphinx.ext.autodoc,\"\n            \"sphinx.ext.autosummary,\"\n            \"docfx_yaml.extension,\"\n            \"sphinx.ext.intersphinx,\"\n            \"sphinx.ext.coverage,\"\n            \"sphinx.ext.napoleon,\"\n            \"sphinx.ext.todo,\"\n            \"sphinx.ext.viewcode,\"\n            \"recommonmark\"\n        ),\n        \"-b\",\n        \"html\",\n        \"-d\",\n        os.path.join(\"docs\", \"_build\", \"doctrees\", \"\"),\n        os.path.join(\"docs\", \"\"),\n        os.path.join(\"docs\", \"_build\", \"html\", \"\"),\n    )\n", "path": "noxfile.py"}], "after_files": [{"content": "# Copyright 2016 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import absolute_import\n\nimport os\nimport shutil\n\nimport nox\n\n\nBLACK_VERSION = \"black==19.10b0\"\nBLACK_PATHS = (\"docs\", \"google\", \"samples\", \"tests\", \"noxfile.py\", \"setup.py\")\n\n\ndef default(session):\n    \"\"\"Default unit test session.\n\n    This is intended to be run **without** an interpreter set, so\n    that the current ``python`` (on the ``PATH``) or the version of\n    Python corresponding to the ``nox`` binary the ``PATH`` can\n    run the tests.\n    \"\"\"\n    # Install all test dependencies, then install local packages in-place.\n    session.install(\n        \"mock\", \"pytest\", \"google-cloud-testutils\", \"pytest-cov\", \"freezegun\"\n    )\n    session.install(\"grpcio\")\n\n    # fastparquet is not included in .[all] because, in general, it's redundant\n    # with pyarrow. We still want to run some unit tests with fastparquet\n    # serialization, though.\n    session.install(\"-e\", \".[all,fastparquet]\")\n\n    # IPython does not support Python 2 after version 5.x\n    if session.python == \"2.7\":\n        session.install(\"ipython==5.5\")\n    else:\n        session.install(\"ipython\")\n\n    # opentelemetry was not added to [all] because opentelemetry does not support Python 2.\n    # Exporter does not need to be in nox thus it has been added to README documentation\n    if session.python != \"2.7\":\n        session.install(\"-e\", \".[opentelemetry]\")\n\n    # Run py.test against the unit tests.\n    session.run(\n        \"py.test\",\n        \"--quiet\",\n        \"--cov=google.cloud.bigquery\",\n        \"--cov=tests.unit\",\n        \"--cov-append\",\n        \"--cov-config=.coveragerc\",\n        \"--cov-report=\",\n        \"--cov-fail-under=0\",\n        os.path.join(\"tests\", \"unit\"),\n        *session.posargs,\n    )\n\n\n@nox.session(python=[\"2.7\", \"3.5\", \"3.6\", \"3.7\", \"3.8\"])\ndef unit(session):\n    \"\"\"Run the unit test suite.\"\"\"\n    default(session)\n\n\n@nox.session(python=[\"2.7\", \"3.8\"])\ndef system(session):\n    \"\"\"Run the system test suite.\"\"\"\n\n    # Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true.\n    if os.environ.get(\"RUN_SYSTEM_TESTS\", \"true\") == \"false\":\n        session.skip(\"RUN_SYSTEM_TESTS is set to false, skipping\")\n\n    # Sanity check: Only run system tests if the environment variable is set.\n    if not os.environ.get(\"GOOGLE_APPLICATION_CREDENTIALS\", \"\"):\n        session.skip(\"Credentials must be set via environment variable.\")\n\n    # Use pre-release gRPC for system tests.\n    session.install(\"--pre\", \"grpcio\")\n\n    # Install all test dependencies, then install local packages in place.\n    session.install(\"mock\", \"pytest\", \"psutil\", \"google-cloud-testutils\")\n    session.install(\"google-cloud-storage\")\n    session.install(\"-e\", \".[all]\")\n\n    # IPython does not support Python 2 after version 5.x\n    if session.python == \"2.7\":\n        session.install(\"ipython==5.5\")\n    else:\n        session.install(\"ipython\")\n\n    # Run py.test against the system tests.\n    session.run(\n        \"py.test\", \"--quiet\", os.path.join(\"tests\", \"system.py\"), *session.posargs\n    )\n\n\n@nox.session(python=[\"2.7\", \"3.8\"])\ndef snippets(session):\n    \"\"\"Run the snippets test suite.\"\"\"\n\n    # Sanity check: Only run snippets tests if the environment variable is set.\n    if not os.environ.get(\"GOOGLE_APPLICATION_CREDENTIALS\", \"\"):\n        session.skip(\"Credentials must be set via environment variable.\")\n\n    # Install all test dependencies, then install local packages in place.\n    session.install(\"mock\", \"pytest\", \"google-cloud-testutils\")\n    session.install(\"google-cloud-storage\")\n    session.install(\"grpcio\")\n    session.install(\"-e\", \".[all]\")\n\n    # Run py.test against the snippets tests.\n    # Skip tests in samples/snippets, as those are run in a different session\n    # using the nox config from that directory.\n    session.run(\"py.test\", os.path.join(\"docs\", \"snippets.py\"), *session.posargs)\n    session.run(\"py.test\", \"samples\", \"--ignore=samples/snippets\", *session.posargs)\n\n\n@nox.session(python=\"3.8\")\ndef cover(session):\n    \"\"\"Run the final coverage report.\n\n    This outputs the coverage report aggregating coverage from the unit\n    test runs (not system test runs), and then erases coverage data.\n    \"\"\"\n    session.install(\"coverage\", \"pytest-cov\")\n    session.run(\"coverage\", \"report\", \"--show-missing\", \"--fail-under=100\")\n    session.run(\"coverage\", \"erase\")\n\n\n@nox.session(python=\"3.8\")\ndef lint(session):\n    \"\"\"Run linters.\n\n    Returns a failure if the linters find linting errors or sufficiently\n    serious code quality issues.\n    \"\"\"\n\n    session.install(\"flake8\", BLACK_VERSION)\n    session.install(\"-e\", \".\")\n    session.run(\"flake8\", os.path.join(\"google\", \"cloud\", \"bigquery\"))\n    session.run(\"flake8\", \"tests\")\n    session.run(\"flake8\", os.path.join(\"docs\", \"samples\"))\n    session.run(\"flake8\", os.path.join(\"docs\", \"snippets.py\"))\n    session.run(\"black\", \"--check\", *BLACK_PATHS)\n\n\n@nox.session(python=\"3.8\")\ndef lint_setup_py(session):\n    \"\"\"Verify that setup.py is valid (including RST check).\"\"\"\n\n    session.install(\"docutils\", \"Pygments\")\n    session.run(\"python\", \"setup.py\", \"check\", \"--restructuredtext\", \"--strict\")\n\n\n@nox.session(python=\"3.6\")\ndef blacken(session):\n    \"\"\"Run black.\n    Format code to uniform standard.\n\n    This currently uses Python 3.6 due to the automated Kokoro run of synthtool.\n    That run uses an image that doesn't have 3.6 installed. Before updating this\n    check the state of the `gcp_ubuntu_config` we use for that Kokoro run.\n    \"\"\"\n    session.install(BLACK_VERSION)\n    session.run(\"black\", *BLACK_PATHS)\n\n\n@nox.session(python=\"3.8\")\ndef docs(session):\n    \"\"\"Build the docs.\"\"\"\n\n    session.install(\"ipython\", \"recommonmark\", \"sphinx\", \"sphinx_rtd_theme\")\n    session.install(\"google-cloud-storage\")\n    session.install(\"-e\", \".[all]\")\n\n    shutil.rmtree(os.path.join(\"docs\", \"_build\"), ignore_errors=True)\n    session.run(\n        \"sphinx-build\",\n        \"-W\",  # warnings as errors\n        \"-T\",  # show full traceback on exception\n        \"-N\",  # no colors\n        \"-b\",\n        \"html\",\n        \"-d\",\n        os.path.join(\"docs\", \"_build\", \"doctrees\", \"\"),\n        os.path.join(\"docs\", \"\"),\n        os.path.join(\"docs\", \"_build\", \"html\", \"\"),\n    )\n\n\n@nox.session(python=\"3.8\")\ndef docfx(session):\n    \"\"\"Build the docfx yaml files for this library.\"\"\"\n\n    session.install(\"-e\", \".\")\n    session.install(\"sphinx\", \"alabaster\", \"recommonmark\", \"sphinx-docfx-yaml\")\n\n    shutil.rmtree(os.path.join(\"docs\", \"_build\"), ignore_errors=True)\n    session.run(\n        \"sphinx-build\",\n        \"-T\",  # show full traceback on exception\n        \"-N\",  # no colors\n        \"-D\",\n        (\n            \"extensions=sphinx.ext.autodoc,\"\n            \"sphinx.ext.autosummary,\"\n            \"docfx_yaml.extension,\"\n            \"sphinx.ext.intersphinx,\"\n            \"sphinx.ext.coverage,\"\n            \"sphinx.ext.napoleon,\"\n            \"sphinx.ext.todo,\"\n            \"sphinx.ext.viewcode,\"\n            \"recommonmark\"\n        ),\n        \"-b\",\n        \"html\",\n        \"-d\",\n        os.path.join(\"docs\", \"_build\", \"doctrees\", \"\"),\n        os.path.join(\"docs\", \"\"),\n        os.path.join(\"docs\", \"_build\", \"html\", \"\"),\n    )\n", "path": "noxfile.py"}]}