We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Noxfile is not updated with Sphinx version pin
`noxfile.py` is not updated with Sphinx version pin, please help take a look!

--- 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 pathlib
18 import os
19 import shutil
20 
21 import nox
22 
23 
24 PYTYPE_VERSION = "pytype==2021.4.9"
25 BLACK_VERSION = "black==19.10b0"
26 BLACK_PATHS = ("docs", "google", "samples", "tests", "noxfile.py", "setup.py")
27 
28 DEFAULT_PYTHON_VERSION = "3.8"
29 SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"]
30 UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
31 CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
32 
33 # 'docfx' is excluded since it only needs to run in 'docs-presubmit'
34 nox.options.sessions = [
35     "unit_noextras",
36     "unit",
37     "system",
38     "snippets",
39     "cover",
40     "lint",
41     "lint_setup_py",
42     "blacken",
43     "pytype",
44     "docs",
45 ]
46 
47 
48 def default(session, install_extras=True):
49     """Default unit test session.
50 
51     This is intended to be run **without** an interpreter set, so
52     that the current ``python`` (on the ``PATH``) or the version of
53     Python corresponding to the ``nox`` binary the ``PATH`` can
54     run the tests.
55     """
56     constraints_path = str(
57         CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
58     )
59 
60     # Install all test dependencies, then install local packages in-place.
61     session.install(
62         "mock",
63         "pytest",
64         "google-cloud-testutils",
65         "pytest-cov",
66         "freezegun",
67         "-c",
68         constraints_path,
69     )
70 
71     install_target = ".[all]" if install_extras else "."
72     session.install("-e", install_target, "-c", constraints_path)
73 
74     session.install("ipython", "-c", constraints_path)
75 
76     # Run py.test against the unit tests.
77     session.run(
78         "py.test",
79         "--quiet",
80         "--cov=google/cloud/bigquery",
81         "--cov=tests/unit",
82         "--cov-append",
83         "--cov-config=.coveragerc",
84         "--cov-report=",
85         "--cov-fail-under=0",
86         os.path.join("tests", "unit"),
87         *session.posargs,
88     )
89 
90 
91 @nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
92 def unit(session):
93     """Run the unit test suite."""
94     default(session)
95 
96 
97 @nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1])
98 def unit_noextras(session):
99     """Run the unit test suite."""
100     default(session, install_extras=False)
101 
102 
103 @nox.session(python=DEFAULT_PYTHON_VERSION)
104 def pytype(session):
105     """Run type checks."""
106     # An indirect dependecy attrs==21.1.0 breaks the check, and installing a less
107     # recent version avoids the error until a possibly better fix is found.
108     # https://github.com/googleapis/python-bigquery/issues/655
109     session.install("attrs==20.3.0")
110     session.install("-e", ".[all]")
111     session.install("ipython")
112     session.install(PYTYPE_VERSION)
113     session.run("pytype")
114 
115 
116 @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
117 def system(session):
118     """Run the system test suite."""
119 
120     constraints_path = str(
121         CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
122     )
123 
124     # Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true.
125     if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false":
126         session.skip("RUN_SYSTEM_TESTS is set to false, skipping")
127 
128     # Sanity check: Only run system tests if the environment variable is set.
129     if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
130         session.skip("Credentials must be set via environment variable.")
131 
132     # Use pre-release gRPC for system tests.
133     session.install("--pre", "grpcio", "-c", constraints_path)
134 
135     # Install all test dependencies, then install local packages in place.
136     session.install(
137         "mock", "pytest", "psutil", "google-cloud-testutils", "-c", constraints_path
138     )
139     if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "") == "true":
140         # mTLS test requires pyopenssl and latest google-cloud-storage
141         session.install("google-cloud-storage", "pyopenssl")
142     else:
143         session.install("google-cloud-storage", "-c", constraints_path)
144 
145     session.install("-e", ".[all]", "-c", constraints_path)
146     session.install("ipython", "-c", constraints_path)
147 
148     # Run py.test against the system tests.
149     session.run("py.test", "--quiet", os.path.join("tests", "system"), *session.posargs)
150 
151 
152 @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
153 def snippets(session):
154     """Run the snippets test suite."""
155 
156     # Check the value of `RUN_SNIPPETS_TESTS` env var. It defaults to true.
157     if os.environ.get("RUN_SNIPPETS_TESTS", "true") == "false":
158         session.skip("RUN_SNIPPETS_TESTS is set to false, skipping")
159 
160     # Sanity check: Only run snippets tests if the environment variable is set.
161     if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
162         session.skip("Credentials must be set via environment variable.")
163 
164     constraints_path = str(
165         CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
166     )
167 
168     # Install all test dependencies, then install local packages in place.
169     session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path)
170     session.install("google-cloud-storage", "-c", constraints_path)
171     session.install("grpcio", "-c", constraints_path)
172 
173     session.install("-e", ".[all]", "-c", constraints_path)
174 
175     # Run py.test against the snippets tests.
176     # Skip tests in samples/snippets, as those are run in a different session
177     # using the nox config from that directory.
178     session.run("py.test", os.path.join("docs", "snippets.py"), *session.posargs)
179     session.run(
180         "py.test",
181         "samples",
182         "--ignore=samples/snippets",
183         "--ignore=samples/geography",
184         *session.posargs,
185     )
186 
187 
188 @nox.session(python=DEFAULT_PYTHON_VERSION)
189 def cover(session):
190     """Run the final coverage report.
191 
192     This outputs the coverage report aggregating coverage from the unit
193     test runs (not system test runs), and then erases coverage data.
194     """
195     session.install("coverage", "pytest-cov")
196     session.run("coverage", "report", "--show-missing", "--fail-under=100")
197     session.run("coverage", "erase")
198 
199 
200 @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
201 def prerelease_deps(session):
202     """Run all tests with prerelease versions of dependencies installed.
203 
204     https://github.com/googleapis/python-bigquery/issues/95
205     """
206     # PyArrow prerelease packages are published to an alternative PyPI host.
207     # https://arrow.apache.org/docs/python/install.html#installing-nightly-packages
208     session.install(
209         "--extra-index-url", "https://pypi.fury.io/arrow-nightlies/", "--pre", "pyarrow"
210     )
211     session.install("--pre", "grpcio", "pandas")
212     session.install(
213         "freezegun",
214         "google-cloud-storage",
215         "google-cloud-testutils",
216         "IPython",
217         "mock",
218         "psutil",
219         "pytest",
220         "pytest-cov",
221     )
222     session.install("-e", ".[all]")
223 
224     # Print out prerelease package versions.
225     session.run("python", "-c", "import grpc; print(grpc.__version__)")
226     session.run("python", "-c", "import pandas; print(pandas.__version__)")
227     session.run("python", "-c", "import pyarrow; print(pyarrow.__version__)")
228 
229     # Run all tests, except a few samples tests which require extra dependencies.
230     session.run("py.test", "tests/unit")
231     session.run("py.test", "tests/system")
232     session.run("py.test", "samples/tests")
233 
234 
235 @nox.session(python=DEFAULT_PYTHON_VERSION)
236 def lint(session):
237     """Run linters.
238 
239     Returns a failure if the linters find linting errors or sufficiently
240     serious code quality issues.
241     """
242 
243     session.install("flake8", BLACK_VERSION)
244     session.install("-e", ".")
245     session.run("flake8", os.path.join("google", "cloud", "bigquery"))
246     session.run("flake8", "tests")
247     session.run("flake8", os.path.join("docs", "samples"))
248     session.run("flake8", os.path.join("docs", "snippets.py"))
249     session.run("black", "--check", *BLACK_PATHS)
250 
251 
252 @nox.session(python=DEFAULT_PYTHON_VERSION)
253 def lint_setup_py(session):
254     """Verify that setup.py is valid (including RST check)."""
255 
256     session.install("docutils", "Pygments")
257     session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
258 
259 
260 @nox.session(python=DEFAULT_PYTHON_VERSION)
261 def blacken(session):
262     """Run black.
263     Format code to uniform standard.
264     """
265 
266     session.install(BLACK_VERSION)
267     session.run("black", *BLACK_PATHS)
268 
269 
270 @nox.session(python=DEFAULT_PYTHON_VERSION)
271 def docs(session):
272     """Build the docs."""
273 
274     session.install("ipython", "recommonmark", "sphinx", "sphinx_rtd_theme")
275     session.install("google-cloud-storage")
276     session.install("-e", ".[all]")
277 
278     shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
279     session.run(
280         "sphinx-build",
281         "-W",  # warnings as errors
282         "-T",  # show full traceback on exception
283         "-N",  # no colors
284         "-b",
285         "html",
286         "-d",
287         os.path.join("docs", "_build", "doctrees", ""),
288         os.path.join("docs", ""),
289         os.path.join("docs", "_build", "html", ""),
290     )
291 
292 
293 @nox.session(python=DEFAULT_PYTHON_VERSION)
294 def docfx(session):
295     """Build the docfx yaml files for this library."""
296 
297     session.install("-e", ".")
298     session.install("sphinx", "alabaster", "recommonmark", "gcp-sphinx-docfx-yaml")
299 
300     shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
301     session.run(
302         "sphinx-build",
303         "-T",  # show full traceback on exception
304         "-N",  # no colors
305         "-D",
306         (
307             "extensions=sphinx.ext.autodoc,"
308             "sphinx.ext.autosummary,"
309             "docfx_yaml.extension,"
310             "sphinx.ext.intersphinx,"
311             "sphinx.ext.coverage,"
312             "sphinx.ext.napoleon,"
313             "sphinx.ext.todo,"
314             "sphinx.ext.viewcode,"
315             "recommonmark"
316         ),
317         "-b",
318         "html",
319         "-d",
320         os.path.join("docs", "_build", "doctrees", ""),
321         os.path.join("docs", ""),
322         os.path.join("docs", "_build", "html", ""),
323     )
324
```
--- 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
@@ -271,7 +271,7 @@
 def docs(session):
     """Build the docs."""
 
-    session.install("ipython", "recommonmark", "sphinx", "sphinx_rtd_theme")
+    session.install("ipython", "recommonmark", "sphinx==4.0.1", "sphinx_rtd_theme")
     session.install("google-cloud-storage")
     session.install("-e", ".[all]")
 
@@ -295,7 +295,9 @@
     """Build the docfx yaml files for this library."""
 
     session.install("-e", ".")
-    session.install("sphinx", "alabaster", "recommonmark", "gcp-sphinx-docfx-yaml")
+    session.install(
+        "sphinx==4.0.1", "alabaster", "recommonmark", "gcp-sphinx-docfx-yaml"
+    )
 
     shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
     session.run(

{"golden_diff": "diff --git a/noxfile.py b/noxfile.py\n--- a/noxfile.py\n+++ b/noxfile.py\n@@ -271,7 +271,7 @@\n def docs(session):\n     \"\"\"Build the docs.\"\"\"\n \n-    session.install(\"ipython\", \"recommonmark\", \"sphinx\", \"sphinx_rtd_theme\")\n+    session.install(\"ipython\", \"recommonmark\", \"sphinx==4.0.1\", \"sphinx_rtd_theme\")\n     session.install(\"google-cloud-storage\")\n     session.install(\"-e\", \".[all]\")\n \n@@ -295,7 +295,9 @@\n     \"\"\"Build the docfx yaml files for this library.\"\"\"\n \n     session.install(\"-e\", \".\")\n-    session.install(\"sphinx\", \"alabaster\", \"recommonmark\", \"gcp-sphinx-docfx-yaml\")\n+    session.install(\n+        \"sphinx==4.0.1\", \"alabaster\", \"recommonmark\", \"gcp-sphinx-docfx-yaml\"\n+    )\n \n     shutil.rmtree(os.path.join(\"docs\", \"_build\"), ignore_errors=True)\n     session.run(\n", "issue": "Noxfile is not updated with Sphinx version pin\n`noxfile.py` is not updated with Sphinx version pin, please help take a look!\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 pathlib\nimport os\nimport shutil\n\nimport nox\n\n\nPYTYPE_VERSION = \"pytype==2021.4.9\"\nBLACK_VERSION = \"black==19.10b0\"\nBLACK_PATHS = (\"docs\", \"google\", \"samples\", \"tests\", \"noxfile.py\", \"setup.py\")\n\nDEFAULT_PYTHON_VERSION = \"3.8\"\nSYSTEM_TEST_PYTHON_VERSIONS = [\"3.8\"]\nUNIT_TEST_PYTHON_VERSIONS = [\"3.6\", \"3.7\", \"3.8\", \"3.9\"]\nCURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()\n\n# 'docfx' is excluded since it only needs to run in 'docs-presubmit'\nnox.options.sessions = [\n    \"unit_noextras\",\n    \"unit\",\n    \"system\",\n    \"snippets\",\n    \"cover\",\n    \"lint\",\n    \"lint_setup_py\",\n    \"blacken\",\n    \"pytype\",\n    \"docs\",\n]\n\n\ndef default(session, install_extras=True):\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    constraints_path = str(\n        CURRENT_DIRECTORY / \"testing\" / f\"constraints-{session.python}.txt\"\n    )\n\n    # Install all test dependencies, then install local packages in-place.\n    session.install(\n        \"mock\",\n        \"pytest\",\n        \"google-cloud-testutils\",\n        \"pytest-cov\",\n        \"freezegun\",\n        \"-c\",\n        constraints_path,\n    )\n\n    install_target = \".[all]\" if install_extras else \".\"\n    session.install(\"-e\", install_target, \"-c\", constraints_path)\n\n    session.install(\"ipython\", \"-c\", constraints_path)\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=UNIT_TEST_PYTHON_VERSIONS)\ndef unit(session):\n    \"\"\"Run the unit test suite.\"\"\"\n    default(session)\n\n\n@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1])\ndef unit_noextras(session):\n    \"\"\"Run the unit test suite.\"\"\"\n    default(session, install_extras=False)\n\n\n@nox.session(python=DEFAULT_PYTHON_VERSION)\ndef pytype(session):\n    \"\"\"Run type checks.\"\"\"\n    # An indirect dependecy attrs==21.1.0 breaks the check, and installing a less\n    # recent version avoids the error until a possibly better fix is found.\n    # https://github.com/googleapis/python-bigquery/issues/655\n    session.install(\"attrs==20.3.0\")\n    session.install(\"-e\", \".[all]\")\n    session.install(\"ipython\")\n    session.install(PYTYPE_VERSION)\n    session.run(\"pytype\")\n\n\n@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)\ndef system(session):\n    \"\"\"Run the system test suite.\"\"\"\n\n    constraints_path = str(\n        CURRENT_DIRECTORY / \"testing\" / f\"constraints-{session.python}.txt\"\n    )\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\", \"-c\", constraints_path)\n\n    # Install all test dependencies, then install local packages in place.\n    session.install(\n        \"mock\", \"pytest\", \"psutil\", \"google-cloud-testutils\", \"-c\", constraints_path\n    )\n    if os.environ.get(\"GOOGLE_API_USE_CLIENT_CERTIFICATE\", \"\") == \"true\":\n        # mTLS test requires pyopenssl and latest google-cloud-storage\n        session.install(\"google-cloud-storage\", \"pyopenssl\")\n    else:\n        session.install(\"google-cloud-storage\", \"-c\", constraints_path)\n\n    session.install(\"-e\", \".[all]\", \"-c\", constraints_path)\n    session.install(\"ipython\", \"-c\", constraints_path)\n\n    # Run py.test against the system tests.\n    session.run(\"py.test\", \"--quiet\", os.path.join(\"tests\", \"system\"), *session.posargs)\n\n\n@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)\ndef snippets(session):\n    \"\"\"Run the snippets test suite.\"\"\"\n\n    # Check the value of `RUN_SNIPPETS_TESTS` env var. It defaults to true.\n    if os.environ.get(\"RUN_SNIPPETS_TESTS\", \"true\") == \"false\":\n        session.skip(\"RUN_SNIPPETS_TESTS is set to false, skipping\")\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    constraints_path = str(\n        CURRENT_DIRECTORY / \"testing\" / f\"constraints-{session.python}.txt\"\n    )\n\n    # Install all test dependencies, then install local packages in place.\n    session.install(\"mock\", \"pytest\", \"google-cloud-testutils\", \"-c\", constraints_path)\n    session.install(\"google-cloud-storage\", \"-c\", constraints_path)\n    session.install(\"grpcio\", \"-c\", constraints_path)\n\n    session.install(\"-e\", \".[all]\", \"-c\", constraints_path)\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(\n        \"py.test\",\n        \"samples\",\n        \"--ignore=samples/snippets\",\n        \"--ignore=samples/geography\",\n        *session.posargs,\n    )\n\n\n@nox.session(python=DEFAULT_PYTHON_VERSION)\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=SYSTEM_TEST_PYTHON_VERSIONS)\ndef prerelease_deps(session):\n    \"\"\"Run all tests with prerelease versions of dependencies installed.\n\n    https://github.com/googleapis/python-bigquery/issues/95\n    \"\"\"\n    # PyArrow prerelease packages are published to an alternative PyPI host.\n    # https://arrow.apache.org/docs/python/install.html#installing-nightly-packages\n    session.install(\n        \"--extra-index-url\", \"https://pypi.fury.io/arrow-nightlies/\", \"--pre\", \"pyarrow\"\n    )\n    session.install(\"--pre\", \"grpcio\", \"pandas\")\n    session.install(\n        \"freezegun\",\n        \"google-cloud-storage\",\n        \"google-cloud-testutils\",\n        \"IPython\",\n        \"mock\",\n        \"psutil\",\n        \"pytest\",\n        \"pytest-cov\",\n    )\n    session.install(\"-e\", \".[all]\")\n\n    # Print out prerelease package versions.\n    session.run(\"python\", \"-c\", \"import grpc; print(grpc.__version__)\")\n    session.run(\"python\", \"-c\", \"import pandas; print(pandas.__version__)\")\n    session.run(\"python\", \"-c\", \"import pyarrow; print(pyarrow.__version__)\")\n\n    # Run all tests, except a few samples tests which require extra dependencies.\n    session.run(\"py.test\", \"tests/unit\")\n    session.run(\"py.test\", \"tests/system\")\n    session.run(\"py.test\", \"samples/tests\")\n\n\n@nox.session(python=DEFAULT_PYTHON_VERSION)\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=DEFAULT_PYTHON_VERSION)\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=DEFAULT_PYTHON_VERSION)\ndef blacken(session):\n    \"\"\"Run black.\n    Format code to uniform standard.\n    \"\"\"\n\n    session.install(BLACK_VERSION)\n    session.run(\"black\", *BLACK_PATHS)\n\n\n@nox.session(python=DEFAULT_PYTHON_VERSION)\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=DEFAULT_PYTHON_VERSION)\ndef docfx(session):\n    \"\"\"Build the docfx yaml files for this library.\"\"\"\n\n    session.install(\"-e\", \".\")\n    session.install(\"sphinx\", \"alabaster\", \"recommonmark\", \"gcp-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 pathlib\nimport os\nimport shutil\n\nimport nox\n\n\nPYTYPE_VERSION = \"pytype==2021.4.9\"\nBLACK_VERSION = \"black==19.10b0\"\nBLACK_PATHS = (\"docs\", \"google\", \"samples\", \"tests\", \"noxfile.py\", \"setup.py\")\n\nDEFAULT_PYTHON_VERSION = \"3.8\"\nSYSTEM_TEST_PYTHON_VERSIONS = [\"3.8\"]\nUNIT_TEST_PYTHON_VERSIONS = [\"3.6\", \"3.7\", \"3.8\", \"3.9\"]\nCURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()\n\n# 'docfx' is excluded since it only needs to run in 'docs-presubmit'\nnox.options.sessions = [\n    \"unit_noextras\",\n    \"unit\",\n    \"system\",\n    \"snippets\",\n    \"cover\",\n    \"lint\",\n    \"lint_setup_py\",\n    \"blacken\",\n    \"pytype\",\n    \"docs\",\n]\n\n\ndef default(session, install_extras=True):\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    constraints_path = str(\n        CURRENT_DIRECTORY / \"testing\" / f\"constraints-{session.python}.txt\"\n    )\n\n    # Install all test dependencies, then install local packages in-place.\n    session.install(\n        \"mock\",\n        \"pytest\",\n        \"google-cloud-testutils\",\n        \"pytest-cov\",\n        \"freezegun\",\n        \"-c\",\n        constraints_path,\n    )\n\n    install_target = \".[all]\" if install_extras else \".\"\n    session.install(\"-e\", install_target, \"-c\", constraints_path)\n\n    session.install(\"ipython\", \"-c\", constraints_path)\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=UNIT_TEST_PYTHON_VERSIONS)\ndef unit(session):\n    \"\"\"Run the unit test suite.\"\"\"\n    default(session)\n\n\n@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1])\ndef unit_noextras(session):\n    \"\"\"Run the unit test suite.\"\"\"\n    default(session, install_extras=False)\n\n\n@nox.session(python=DEFAULT_PYTHON_VERSION)\ndef pytype(session):\n    \"\"\"Run type checks.\"\"\"\n    # An indirect dependecy attrs==21.1.0 breaks the check, and installing a less\n    # recent version avoids the error until a possibly better fix is found.\n    # https://github.com/googleapis/python-bigquery/issues/655\n    session.install(\"attrs==20.3.0\")\n    session.install(\"-e\", \".[all]\")\n    session.install(\"ipython\")\n    session.install(PYTYPE_VERSION)\n    session.run(\"pytype\")\n\n\n@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)\ndef system(session):\n    \"\"\"Run the system test suite.\"\"\"\n\n    constraints_path = str(\n        CURRENT_DIRECTORY / \"testing\" / f\"constraints-{session.python}.txt\"\n    )\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\", \"-c\", constraints_path)\n\n    # Install all test dependencies, then install local packages in place.\n    session.install(\n        \"mock\", \"pytest\", \"psutil\", \"google-cloud-testutils\", \"-c\", constraints_path\n    )\n    if os.environ.get(\"GOOGLE_API_USE_CLIENT_CERTIFICATE\", \"\") == \"true\":\n        # mTLS test requires pyopenssl and latest google-cloud-storage\n        session.install(\"google-cloud-storage\", \"pyopenssl\")\n    else:\n        session.install(\"google-cloud-storage\", \"-c\", constraints_path)\n\n    session.install(\"-e\", \".[all]\", \"-c\", constraints_path)\n    session.install(\"ipython\", \"-c\", constraints_path)\n\n    # Run py.test against the system tests.\n    session.run(\"py.test\", \"--quiet\", os.path.join(\"tests\", \"system\"), *session.posargs)\n\n\n@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)\ndef snippets(session):\n    \"\"\"Run the snippets test suite.\"\"\"\n\n    # Check the value of `RUN_SNIPPETS_TESTS` env var. It defaults to true.\n    if os.environ.get(\"RUN_SNIPPETS_TESTS\", \"true\") == \"false\":\n        session.skip(\"RUN_SNIPPETS_TESTS is set to false, skipping\")\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    constraints_path = str(\n        CURRENT_DIRECTORY / \"testing\" / f\"constraints-{session.python}.txt\"\n    )\n\n    # Install all test dependencies, then install local packages in place.\n    session.install(\"mock\", \"pytest\", \"google-cloud-testutils\", \"-c\", constraints_path)\n    session.install(\"google-cloud-storage\", \"-c\", constraints_path)\n    session.install(\"grpcio\", \"-c\", constraints_path)\n\n    session.install(\"-e\", \".[all]\", \"-c\", constraints_path)\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(\n        \"py.test\",\n        \"samples\",\n        \"--ignore=samples/snippets\",\n        \"--ignore=samples/geography\",\n        *session.posargs,\n    )\n\n\n@nox.session(python=DEFAULT_PYTHON_VERSION)\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=SYSTEM_TEST_PYTHON_VERSIONS)\ndef prerelease_deps(session):\n    \"\"\"Run all tests with prerelease versions of dependencies installed.\n\n    https://github.com/googleapis/python-bigquery/issues/95\n    \"\"\"\n    # PyArrow prerelease packages are published to an alternative PyPI host.\n    # https://arrow.apache.org/docs/python/install.html#installing-nightly-packages\n    session.install(\n        \"--extra-index-url\", \"https://pypi.fury.io/arrow-nightlies/\", \"--pre\", \"pyarrow\"\n    )\n    session.install(\"--pre\", \"grpcio\", \"pandas\")\n    session.install(\n        \"freezegun\",\n        \"google-cloud-storage\",\n        \"google-cloud-testutils\",\n        \"IPython\",\n        \"mock\",\n        \"psutil\",\n        \"pytest\",\n        \"pytest-cov\",\n    )\n    session.install(\"-e\", \".[all]\")\n\n    # Print out prerelease package versions.\n    session.run(\"python\", \"-c\", \"import grpc; print(grpc.__version__)\")\n    session.run(\"python\", \"-c\", \"import pandas; print(pandas.__version__)\")\n    session.run(\"python\", \"-c\", \"import pyarrow; print(pyarrow.__version__)\")\n\n    # Run all tests, except a few samples tests which require extra dependencies.\n    session.run(\"py.test\", \"tests/unit\")\n    session.run(\"py.test\", \"tests/system\")\n    session.run(\"py.test\", \"samples/tests\")\n\n\n@nox.session(python=DEFAULT_PYTHON_VERSION)\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=DEFAULT_PYTHON_VERSION)\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=DEFAULT_PYTHON_VERSION)\ndef blacken(session):\n    \"\"\"Run black.\n    Format code to uniform standard.\n    \"\"\"\n\n    session.install(BLACK_VERSION)\n    session.run(\"black\", *BLACK_PATHS)\n\n\n@nox.session(python=DEFAULT_PYTHON_VERSION)\ndef docs(session):\n    \"\"\"Build the docs.\"\"\"\n\n    session.install(\"ipython\", \"recommonmark\", \"sphinx==4.0.1\", \"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=DEFAULT_PYTHON_VERSION)\ndef docfx(session):\n    \"\"\"Build the docfx yaml files for this library.\"\"\"\n\n    session.install(\"-e\", \".\")\n    session.install(\n        \"sphinx==4.0.1\", \"alabaster\", \"recommonmark\", \"gcp-sphinx-docfx-yaml\"\n    )\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"}]}