We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add "continuous" job for prerelease deps tests
Follow-up to https://github.com/googleapis/python-bigquery/issues/95

We should have a continuous (nightly) job that tests with presubmits. We usually have PRs open, but it'd be good to have timely notifications from flakey bot if something happens when we aren't making a PR.

Also, we should double-check that as we add pyarrow and such to required dependencies that we're still able to test with pre-release versions. It'd be good to ignore our pins so that we know when a dependency makes a breaking change.

--- 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[0], UNIT_TEST_PYTHON_VERSIONS[-1]])
98 def unit_noextras(session):
99     """Run the unit test suite."""
100 
101     # Install optional dependencies that are out-of-date.
102     # https://github.com/googleapis/python-bigquery/issues/933
103     # There is no pyarrow 1.0.0 package for Python 3.9.
104     if session.python == UNIT_TEST_PYTHON_VERSIONS[0]:
105         session.install("pyarrow==1.0.0")
106 
107     default(session, install_extras=False)
108 
109 
110 @nox.session(python=DEFAULT_PYTHON_VERSION)
111 def pytype(session):
112     """Run type checks."""
113     # An indirect dependecy attrs==21.1.0 breaks the check, and installing a less
114     # recent version avoids the error until a possibly better fix is found.
115     # https://github.com/googleapis/python-bigquery/issues/655
116     session.install("attrs==20.3.0")
117     session.install("-e", ".[all]")
118     session.install("ipython")
119     session.install(PYTYPE_VERSION)
120     session.run("pytype")
121 
122 
123 @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
124 def system(session):
125     """Run the system test suite."""
126 
127     constraints_path = str(
128         CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
129     )
130 
131     # Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true.
132     if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false":
133         session.skip("RUN_SYSTEM_TESTS is set to false, skipping")
134 
135     # Sanity check: Only run system tests if the environment variable is set.
136     if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
137         session.skip("Credentials must be set via environment variable.")
138 
139     # Use pre-release gRPC for system tests.
140     session.install("--pre", "grpcio", "-c", constraints_path)
141 
142     # Install all test dependencies, then install local packages in place.
143     session.install(
144         "mock", "pytest", "psutil", "google-cloud-testutils", "-c", constraints_path
145     )
146     if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "") == "true":
147         # mTLS test requires pyopenssl and latest google-cloud-storage
148         session.install("google-cloud-storage", "pyopenssl")
149     else:
150         session.install("google-cloud-storage", "-c", constraints_path)
151 
152     # Data Catalog needed for the column ACL test with a real Policy Tag.
153     session.install("google-cloud-datacatalog", "-c", constraints_path)
154 
155     session.install("-e", ".[all]", "-c", constraints_path)
156     session.install("ipython", "-c", constraints_path)
157 
158     # Run py.test against the system tests.
159     session.run("py.test", "--quiet", os.path.join("tests", "system"), *session.posargs)
160 
161 
162 @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
163 def snippets(session):
164     """Run the snippets test suite."""
165 
166     # Check the value of `RUN_SNIPPETS_TESTS` env var. It defaults to true.
167     if os.environ.get("RUN_SNIPPETS_TESTS", "true") == "false":
168         session.skip("RUN_SNIPPETS_TESTS is set to false, skipping")
169 
170     constraints_path = str(
171         CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
172     )
173 
174     # Install all test dependencies, then install local packages in place.
175     session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path)
176     session.install("google-cloud-storage", "-c", constraints_path)
177     session.install("grpcio", "-c", constraints_path)
178 
179     session.install("-e", ".[all]", "-c", constraints_path)
180 
181     # Run py.test against the snippets tests.
182     # Skip tests in samples/snippets, as those are run in a different session
183     # using the nox config from that directory.
184     session.run("py.test", os.path.join("docs", "snippets.py"), *session.posargs)
185     session.run(
186         "py.test",
187         "samples",
188         "--ignore=samples/snippets",
189         "--ignore=samples/geography",
190         *session.posargs,
191     )
192 
193 
194 @nox.session(python=DEFAULT_PYTHON_VERSION)
195 def cover(session):
196     """Run the final coverage report.
197 
198     This outputs the coverage report aggregating coverage from the unit
199     test runs (not system test runs), and then erases coverage data.
200     """
201     session.install("coverage", "pytest-cov")
202     session.run("coverage", "report", "--show-missing", "--fail-under=100")
203     session.run("coverage", "erase")
204 
205 
206 @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
207 def prerelease_deps(session):
208     """Run all tests with prerelease versions of dependencies installed.
209 
210     https://github.com/googleapis/python-bigquery/issues/95
211     """
212     # PyArrow prerelease packages are published to an alternative PyPI host.
213     # https://arrow.apache.org/docs/python/install.html#installing-nightly-packages
214     session.install(
215         "--extra-index-url", "https://pypi.fury.io/arrow-nightlies/", "--pre", "pyarrow"
216     )
217     session.install(
218         "--pre",
219         "google-api-core",
220         "google-cloud-bigquery-storage",
221         "google-cloud-core",
222         "google-resumable-media",
223         "grpcio",
224         "pandas",
225     )
226     session.install(
227         "freezegun",
228         "google-cloud-datacatalog",
229         "google-cloud-storage",
230         "google-cloud-testutils",
231         "IPython",
232         "mock",
233         "psutil",
234         "pytest",
235         "pytest-cov",
236     )
237     session.install("-e", ".[all]")
238 
239     # Print out prerelease package versions.
240     session.run("python", "-c", "import grpc; print(grpc.__version__)")
241     session.run("python", "-c", "import pandas; print(pandas.__version__)")
242     session.run("python", "-c", "import pyarrow; print(pyarrow.__version__)")
243 
244     # Run all tests, except a few samples tests which require extra dependencies.
245     session.run("py.test", "tests/unit")
246     session.run("py.test", "tests/system")
247     session.run("py.test", "samples/tests")
248 
249 
250 @nox.session(python=DEFAULT_PYTHON_VERSION)
251 def lint(session):
252     """Run linters.
253 
254     Returns a failure if the linters find linting errors or sufficiently
255     serious code quality issues.
256     """
257 
258     session.install("flake8", BLACK_VERSION)
259     session.install("-e", ".")
260     session.run("flake8", os.path.join("google", "cloud", "bigquery"))
261     session.run("flake8", "tests")
262     session.run("flake8", os.path.join("docs", "samples"))
263     session.run("flake8", os.path.join("docs", "snippets.py"))
264     session.run("black", "--check", *BLACK_PATHS)
265 
266 
267 @nox.session(python=DEFAULT_PYTHON_VERSION)
268 def lint_setup_py(session):
269     """Verify that setup.py is valid (including RST check)."""
270 
271     session.install("docutils", "Pygments")
272     session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
273 
274 
275 @nox.session(python=DEFAULT_PYTHON_VERSION)
276 def blacken(session):
277     """Run black.
278     Format code to uniform standard.
279     """
280 
281     session.install(BLACK_VERSION)
282     session.run("black", *BLACK_PATHS)
283 
284 
285 @nox.session(python=DEFAULT_PYTHON_VERSION)
286 def docs(session):
287     """Build the docs."""
288 
289     session.install("ipython", "recommonmark", "sphinx==4.0.1", "sphinx_rtd_theme")
290     session.install("google-cloud-storage")
291     session.install("-e", ".[all]")
292 
293     shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
294     session.run(
295         "sphinx-build",
296         "-W",  # warnings as errors
297         "-T",  # show full traceback on exception
298         "-N",  # no colors
299         "-b",
300         "html",
301         "-d",
302         os.path.join("docs", "_build", "doctrees", ""),
303         os.path.join("docs", ""),
304         os.path.join("docs", "_build", "html", ""),
305     )
306 
307 
308 @nox.session(python=DEFAULT_PYTHON_VERSION)
309 def docfx(session):
310     """Build the docfx yaml files for this library."""
311 
312     session.install("-e", ".")
313     session.install(
314         "sphinx==4.0.1", "alabaster", "recommonmark", "gcp-sphinx-docfx-yaml"
315     )
316 
317     shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
318     session.run(
319         "sphinx-build",
320         "-T",  # show full traceback on exception
321         "-N",  # no colors
322         "-D",
323         (
324             "extensions=sphinx.ext.autodoc,"
325             "sphinx.ext.autosummary,"
326             "docfx_yaml.extension,"
327             "sphinx.ext.intersphinx,"
328             "sphinx.ext.coverage,"
329             "sphinx.ext.napoleon,"
330             "sphinx.ext.todo,"
331             "sphinx.ext.viewcode,"
332             "recommonmark"
333         ),
334         "-b",
335         "html",
336         "-d",
337         os.path.join("docs", "_build", "doctrees", ""),
338         os.path.join("docs", ""),
339         os.path.join("docs", "_build", "html", ""),
340     )
341
```
--- 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
@@ -16,6 +16,7 @@
 
 import pathlib
 import os
+import re
 import shutil
 
 import nox
@@ -212,16 +213,30 @@
     # PyArrow prerelease packages are published to an alternative PyPI host.
     # https://arrow.apache.org/docs/python/install.html#installing-nightly-packages
     session.install(
-        "--extra-index-url", "https://pypi.fury.io/arrow-nightlies/", "--pre", "pyarrow"
+        "--extra-index-url",
+        "https://pypi.fury.io/arrow-nightlies/",
+        "--prefer-binary",
+        "--pre",
+        "--upgrade",
+        "pyarrow",
     )
     session.install(
+        "--extra-index-url",
+        "https://pypi.anaconda.org/scipy-wheels-nightly/simple",
+        "--prefer-binary",
         "--pre",
+        "--upgrade",
+        "pandas",
+    )
+
+    session.install(
+        "--pre",
+        "--upgrade",
         "google-api-core",
         "google-cloud-bigquery-storage",
         "google-cloud-core",
         "google-resumable-media",
         "grpcio",
-        "pandas",
     )
     session.install(
         "freezegun",
@@ -234,7 +249,30 @@
         "pytest",
         "pytest-cov",
     )
-    session.install("-e", ".[all]")
+
+    # Because we test minimum dependency versions on the minimum Python
+    # version, the first version we test with in the unit tests sessions has a
+    # constraints file containing all dependencies and extras.
+    with open(
+        CURRENT_DIRECTORY
+        / "testing"
+        / f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
+        encoding="utf-8",
+    ) as constraints_file:
+        constraints_text = constraints_file.read()
+
+    # Ignore leading whitespace and comment lines.
+    deps = [
+        match.group(1)
+        for match in re.finditer(
+            r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE
+        )
+    ]
+
+    # We use --no-deps to ensure that pre-release versions aren't overwritten
+    # by the version ranges in setup.py.
+    session.install(*deps)
+    session.install("--no-deps", "-e", ".[all]")
 
     # Print out prerelease package versions.
     session.run("python", "-c", "import grpc; print(grpc.__version__)")

{"golden_diff": "diff --git a/noxfile.py b/noxfile.py\n--- a/noxfile.py\n+++ b/noxfile.py\n@@ -16,6 +16,7 @@\n \n import pathlib\n import os\n+import re\n import shutil\n \n import nox\n@@ -212,16 +213,30 @@\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+        \"--extra-index-url\",\n+        \"https://pypi.fury.io/arrow-nightlies/\",\n+        \"--prefer-binary\",\n+        \"--pre\",\n+        \"--upgrade\",\n+        \"pyarrow\",\n     )\n     session.install(\n+        \"--extra-index-url\",\n+        \"https://pypi.anaconda.org/scipy-wheels-nightly/simple\",\n+        \"--prefer-binary\",\n         \"--pre\",\n+        \"--upgrade\",\n+        \"pandas\",\n+    )\n+\n+    session.install(\n+        \"--pre\",\n+        \"--upgrade\",\n         \"google-api-core\",\n         \"google-cloud-bigquery-storage\",\n         \"google-cloud-core\",\n         \"google-resumable-media\",\n         \"grpcio\",\n-        \"pandas\",\n     )\n     session.install(\n         \"freezegun\",\n@@ -234,7 +249,30 @@\n         \"pytest\",\n         \"pytest-cov\",\n     )\n-    session.install(\"-e\", \".[all]\")\n+\n+    # Because we test minimum dependency versions on the minimum Python\n+    # version, the first version we test with in the unit tests sessions has a\n+    # constraints file containing all dependencies and extras.\n+    with open(\n+        CURRENT_DIRECTORY\n+        / \"testing\"\n+        / f\"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt\",\n+        encoding=\"utf-8\",\n+    ) as constraints_file:\n+        constraints_text = constraints_file.read()\n+\n+    # Ignore leading whitespace and comment lines.\n+    deps = [\n+        match.group(1)\n+        for match in re.finditer(\n+            r\"^\\s*(\\S+)(?===\\S+)\", constraints_text, flags=re.MULTILINE\n+        )\n+    ]\n+\n+    # We use --no-deps to ensure that pre-release versions aren't overwritten\n+    # by the version ranges in setup.py.\n+    session.install(*deps)\n+    session.install(\"--no-deps\", \"-e\", \".[all]\")\n \n     # Print out prerelease package versions.\n     session.run(\"python\", \"-c\", \"import grpc; print(grpc.__version__)\")\n", "issue": "Add \"continuous\" job for prerelease deps tests\nFollow-up to https://github.com/googleapis/python-bigquery/issues/95\r\n\r\nWe should have a continuous (nightly) job that tests with presubmits. We usually have PRs open, but it'd be good to have timely notifications from flakey bot if something happens when we aren't making a PR.\r\n\r\nAlso, we should double-check that as we add pyarrow and such to required dependencies that we're still able to test with pre-release versions. It'd be good to ignore our pins so that we know when a dependency makes a breaking change.\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[0], UNIT_TEST_PYTHON_VERSIONS[-1]])\ndef unit_noextras(session):\n    \"\"\"Run the unit test suite.\"\"\"\n\n    # Install optional dependencies that are out-of-date.\n    # https://github.com/googleapis/python-bigquery/issues/933\n    # There is no pyarrow 1.0.0 package for Python 3.9.\n    if session.python == UNIT_TEST_PYTHON_VERSIONS[0]:\n        session.install(\"pyarrow==1.0.0\")\n\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    # Data Catalog needed for the column ACL test with a real Policy Tag.\n    session.install(\"google-cloud-datacatalog\", \"-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    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(\n        \"--pre\",\n        \"google-api-core\",\n        \"google-cloud-bigquery-storage\",\n        \"google-cloud-core\",\n        \"google-resumable-media\",\n        \"grpcio\",\n        \"pandas\",\n    )\n    session.install(\n        \"freezegun\",\n        \"google-cloud-datacatalog\",\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"}], "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 re\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[0], UNIT_TEST_PYTHON_VERSIONS[-1]])\ndef unit_noextras(session):\n    \"\"\"Run the unit test suite.\"\"\"\n\n    # Install optional dependencies that are out-of-date.\n    # https://github.com/googleapis/python-bigquery/issues/933\n    # There is no pyarrow 1.0.0 package for Python 3.9.\n    if session.python == UNIT_TEST_PYTHON_VERSIONS[0]:\n        session.install(\"pyarrow==1.0.0\")\n\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    # Data Catalog needed for the column ACL test with a real Policy Tag.\n    session.install(\"google-cloud-datacatalog\", \"-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    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\",\n        \"https://pypi.fury.io/arrow-nightlies/\",\n        \"--prefer-binary\",\n        \"--pre\",\n        \"--upgrade\",\n        \"pyarrow\",\n    )\n    session.install(\n        \"--extra-index-url\",\n        \"https://pypi.anaconda.org/scipy-wheels-nightly/simple\",\n        \"--prefer-binary\",\n        \"--pre\",\n        \"--upgrade\",\n        \"pandas\",\n    )\n\n    session.install(\n        \"--pre\",\n        \"--upgrade\",\n        \"google-api-core\",\n        \"google-cloud-bigquery-storage\",\n        \"google-cloud-core\",\n        \"google-resumable-media\",\n        \"grpcio\",\n    )\n    session.install(\n        \"freezegun\",\n        \"google-cloud-datacatalog\",\n        \"google-cloud-storage\",\n        \"google-cloud-testutils\",\n        \"IPython\",\n        \"mock\",\n        \"psutil\",\n        \"pytest\",\n        \"pytest-cov\",\n    )\n\n    # Because we test minimum dependency versions on the minimum Python\n    # version, the first version we test with in the unit tests sessions has a\n    # constraints file containing all dependencies and extras.\n    with open(\n        CURRENT_DIRECTORY\n        / \"testing\"\n        / f\"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt\",\n        encoding=\"utf-8\",\n    ) as constraints_file:\n        constraints_text = constraints_file.read()\n\n    # Ignore leading whitespace and comment lines.\n    deps = [\n        match.group(1)\n        for match in re.finditer(\n            r\"^\\s*(\\S+)(?===\\S+)\", constraints_text, flags=re.MULTILINE\n        )\n    ]\n\n    # We use --no-deps to ensure that pre-release versions aren't overwritten\n    # by the version ranges in setup.py.\n    session.install(*deps)\n    session.install(\"--no-deps\", \"-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"}]}