prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Modify noxfile to build and test the package
  Versions `2.0.0` and `2.0.1` were yanked from PyPI last week due to an issue where discovery documents were not included in the published package causing `discovery.build()` to fail(#1214).  A basic check could be added to verify the package works correctly using the steps in #1214. Ideally it should be done on every PR and push to master so the issue can be caught before the package is published. 
  
  Use these steps from #1214 to re-produce the issue with version `2.0.0` and `2.0.1`:
  1. Start with a clean clone of `google-api-python-client`
  2. Checkout version `2.0.0` or `2.0.1`, using `git checkout 2.0.0`
  3. Run `python setup.py sdist`
  4. Run `pip install dist/google-api-python-client-<version>.tar.gz`
  5. Run 
  ```
  $ python3
  Python 3.8.7 (default, Jan 27 2021, 18:44:05) 
  [GCC 10.2.1 20201224] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>> from googleapiclient import discovery
  >>> client = discovery.build("cloudprofiler", "v2")
  ...
  ```
  
  Before closing this issue, we should ensure that we have checks in place so that a PR will fail if `package_data` [here](https://github.com/googleapis/google-api-python-client/blob/master/setup.py#L78) is empty.
  
  
  --- 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 
  2 # Copyright 2020 Google LLC
  3 #
  4 # Licensed under the Apache License, Version 2.0 (the "License");
  5 # you may not use this file except in compliance with the License.
  6 # You may obtain a copy of the License at
  7 #
  8 #      http://www.apache.org/licenses/LICENSE-2.0
  9 #
  10 # Unless required by applicable law or agreed to in writing, software
  11 # distributed under the License is distributed on an "AS IS" BASIS,
  12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 # See the License for the specific language governing permissions and
  14 # limitations under the License.
  15 
  16 import sys
  17 
  18 import nox
  19 
  20 test_dependencies = [
  21     "django>=2.0.0",
  22     "google-auth",
  23     "google-auth-httplib2",
  24     "mox",
  25     "parameterized",
  26     "pyopenssl",
  27     "pytest",
  28     "pytest-cov",
  29     "webtest",
  30     "coverage",
  31     "unittest2",
  32     "mock",
  33 ]
  34 
  35 
  36 @nox.session(python=["3.7"])
  37 def lint(session):
  38     session.install("flake8")
  39     session.run(
  40         "flake8",
  41         "googleapiclient",
  42         "tests",
  43         "--count",
  44         "--select=E9,F63,F7,F82",
  45         "--show-source",
  46         "--statistics",
  47     )
  48 
  49 
  50 @nox.session(python=["3.6", "3.7", "3.8", "3.9"])
  51 @nox.parametrize(
  52     "oauth2client",
  53     [
  54         "oauth2client<2dev",
  55         "oauth2client>=2,<=3dev",
  56         "oauth2client>=3,<=4dev",
  57         "oauth2client>=4,<=5dev",
  58     ],
  59 )
  60 def unit(session, oauth2client):
  61     session.install(*test_dependencies)
  62     session.install(oauth2client)
  63     session.install('.')
  64 
  65     # Run py.test against the unit tests.
  66     session.run(
  67         "py.test",
  68         "--quiet",
  69         "--cov=googleapiclient",
  70         "--cov=tests",
  71         "--cov-append",
  72         "--cov-config=.coveragerc",
  73         "--cov-report=",
  74         "--cov-fail-under=85",
  75         "tests",
  76         *session.posargs,
  77     )
  78
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/noxfile.py b/noxfile.py
  --- a/noxfile.py
  +++ b/noxfile.py
  @@ -16,6 +16,8 @@
   import sys
   
   import nox
  +import os
  +import shutil
   
   test_dependencies = [
       "django>=2.0.0",
  @@ -58,9 +60,22 @@
       ],
   )
   def unit(session, oauth2client):
  +    # Clean up dist and build folders
  +    shutil.rmtree('dist', ignore_errors=True)
  +    shutil.rmtree('build', ignore_errors=True)
  +
       session.install(*test_dependencies)
       session.install(oauth2client)
  -    session.install('.')
  +
  +    # Create and install wheels
  +    session.run('python3', 'setup.py', 'bdist_wheel')
  +    session.install(os.path.join('dist', os.listdir('dist').pop()))
  +
  +    # Run tests from a different directory to test the package artifacts
  +    root_dir = os.path.dirname(os.path.realpath(__file__))
  +    temp_dir = session.create_tmp()
  +    session.chdir(temp_dir)
  +    shutil.copytree(os.path.join(root_dir, 'tests'), 'tests')
   
       # Run py.test against the unit tests.
       session.run(
  
verification_info: {"golden_diff": "diff --git a/noxfile.py b/noxfile.py\n--- a/noxfile.py\n+++ b/noxfile.py\n@@ -16,6 +16,8 @@\n import sys\n \n import nox\n+import os\n+import shutil\n \n test_dependencies = [\n     \"django>=2.0.0\",\n@@ -58,9 +60,22 @@\n     ],\n )\n def unit(session, oauth2client):\n+    # Clean up dist and build folders\n+    shutil.rmtree('dist', ignore_errors=True)\n+    shutil.rmtree('build', ignore_errors=True)\n+\n     session.install(*test_dependencies)\n     session.install(oauth2client)\n-    session.install('.')\n+\n+    # Create and install wheels\n+    session.run('python3', 'setup.py', 'bdist_wheel')\n+    session.install(os.path.join('dist', os.listdir('dist').pop()))\n+\n+    # Run tests from a different directory to test the package artifacts\n+    root_dir = os.path.dirname(os.path.realpath(__file__))\n+    temp_dir = session.create_tmp()\n+    session.chdir(temp_dir)\n+    shutil.copytree(os.path.join(root_dir, 'tests'), 'tests')\n \n     # Run py.test against the unit tests.\n     session.run(\n", "issue": "Modify noxfile to build and test the package\nVersions `2.0.0` and `2.0.1` were yanked from PyPI last week due to an issue where discovery documents were not included in the published package causing `discovery.build()` to fail(#1214).  A basic check could be added to verify the package works correctly using the steps in #1214. Ideally it should be done on every PR and push to master so the issue can be caught before the package is published. \r\n\r\nUse these steps from #1214 to re-produce the issue with version `2.0.0` and `2.0.1`:\r\n1. Start with a clean clone of `google-api-python-client`\r\n2. Checkout version `2.0.0` or `2.0.1`, using `git checkout 2.0.0`\r\n3. Run `python setup.py sdist`\r\n4. Run `pip install dist/google-api-python-client-<version>.tar.gz`\r\n5. Run \r\n```\r\n$ python3\r\nPython 3.8.7 (default, Jan 27 2021, 18:44:05) \r\n[GCC 10.2.1 20201224] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> from googleapiclient import discovery\r\n>>> client = discovery.build(\"cloudprofiler\", \"v2\")\r\n...\r\n```\r\n\r\nBefore closing this issue, we should ensure that we have checks in place so that a PR will fail if `package_data` [here](https://github.com/googleapis/google-api-python-client/blob/master/setup.py#L78) is empty.\r\n\n", "before_files": [{"content": "\n# Copyright 2020 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\nimport sys\n\nimport nox\n\ntest_dependencies = [\n    \"django>=2.0.0\",\n    \"google-auth\",\n    \"google-auth-httplib2\",\n    \"mox\",\n    \"parameterized\",\n    \"pyopenssl\",\n    \"pytest\",\n    \"pytest-cov\",\n    \"webtest\",\n    \"coverage\",\n    \"unittest2\",\n    \"mock\",\n]\n\n\n@nox.session(python=[\"3.7\"])\ndef lint(session):\n    session.install(\"flake8\")\n    session.run(\n        \"flake8\",\n        \"googleapiclient\",\n        \"tests\",\n        \"--count\",\n        \"--select=E9,F63,F7,F82\",\n        \"--show-source\",\n        \"--statistics\",\n    )\n\n\n@nox.session(python=[\"3.6\", \"3.7\", \"3.8\", \"3.9\"])\n@nox.parametrize(\n    \"oauth2client\",\n    [\n        \"oauth2client<2dev\",\n        \"oauth2client>=2,<=3dev\",\n        \"oauth2client>=3,<=4dev\",\n        \"oauth2client>=4,<=5dev\",\n    ],\n)\ndef unit(session, oauth2client):\n    session.install(*test_dependencies)\n    session.install(oauth2client)\n    session.install('.')\n\n    # Run py.test against the unit tests.\n    session.run(\n        \"py.test\",\n        \"--quiet\",\n        \"--cov=googleapiclient\",\n        \"--cov=tests\",\n        \"--cov-append\",\n        \"--cov-config=.coveragerc\",\n        \"--cov-report=\",\n        \"--cov-fail-under=85\",\n        \"tests\",\n        *session.posargs,\n    )\n", "path": "noxfile.py"}], "after_files": [{"content": "\n# Copyright 2020 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\nimport sys\n\nimport nox\nimport os\nimport shutil\n\ntest_dependencies = [\n    \"django>=2.0.0\",\n    \"google-auth\",\n    \"google-auth-httplib2\",\n    \"mox\",\n    \"parameterized\",\n    \"pyopenssl\",\n    \"pytest\",\n    \"pytest-cov\",\n    \"webtest\",\n    \"coverage\",\n    \"unittest2\",\n    \"mock\",\n]\n\n\n@nox.session(python=[\"3.7\"])\ndef lint(session):\n    session.install(\"flake8\")\n    session.run(\n        \"flake8\",\n        \"googleapiclient\",\n        \"tests\",\n        \"--count\",\n        \"--select=E9,F63,F7,F82\",\n        \"--show-source\",\n        \"--statistics\",\n    )\n\n\n@nox.session(python=[\"3.6\", \"3.7\", \"3.8\", \"3.9\"])\n@nox.parametrize(\n    \"oauth2client\",\n    [\n        \"oauth2client<2dev\",\n        \"oauth2client>=2,<=3dev\",\n        \"oauth2client>=3,<=4dev\",\n        \"oauth2client>=4,<=5dev\",\n    ],\n)\ndef unit(session, oauth2client):\n    # Clean up dist and build folders\n    shutil.rmtree('dist', ignore_errors=True)\n    shutil.rmtree('build', ignore_errors=True)\n\n    session.install(*test_dependencies)\n    session.install(oauth2client)\n\n    # Create and install wheels\n    session.run('python3', 'setup.py', 'bdist_wheel')\n    session.install(os.path.join('dist', os.listdir('dist').pop()))\n\n    # Run tests from a different directory to test the package artifacts\n    root_dir = os.path.dirname(os.path.realpath(__file__))\n    temp_dir = session.create_tmp()\n    session.chdir(temp_dir)\n    shutil.copytree(os.path.join(root_dir, 'tests'), 'tests')\n\n    # Run py.test against the unit tests.\n    session.run(\n        \"py.test\",\n        \"--quiet\",\n        \"--cov=googleapiclient\",\n        \"--cov=tests\",\n        \"--cov-append\",\n        \"--cov-config=.coveragerc\",\n        \"--cov-report=\",\n        \"--cov-fail-under=85\",\n        \"tests\",\n        *session.posargs,\n    )\n", "path": "noxfile.py"}]}