We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[Bug] setuptools finds and installs tests/ as a top-level package in site-packages/


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
2 # type: ignore
3 import codecs
4 import os
5 import pathlib
6 import re
7 import shutil
8 from distutils import cmd
9 from os.path import exists, isdir, join
10 from typing import Any, List
11 
12 import pkg_resources
13 from setuptools import find_packages, setup
14 
15 here = os.path.abspath(os.path.dirname(__file__))
16 
17 
18 def read(*parts):
19     with codecs.open(os.path.join(here, *parts), "r") as fp:
20         return fp.read()
21 
22 
23 def find_version(*file_paths):
24     version_file = read(*file_paths)
25     version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
26     if version_match:
27         return version_match.group(1)
28     raise RuntimeError("Unable to find version string.")
29 
30 
31 with pathlib.Path("requirements/requirements.txt").open() as requirements_txt:
32     install_requires = [
33         str(requirement)
34         for requirement in pkg_resources.parse_requirements(requirements_txt)
35     ]
36 
37 
38 class CleanCommand(cmd.Command):
39     """
40     Our custom command to clean out junk files.
41     """
42 
43     description = "Cleans out junk files we don't want in the repo"
44     user_options: List[Any] = []
45 
46     def initialize_options(self):
47         pass
48 
49     def finalize_options(self):
50         pass
51 
52     @staticmethod
53     def find(root, includes, excludes=[]):
54         res = []
55         for parent, dirs, files in os.walk(root):
56             for f in dirs + files:
57                 add = list()
58                 for include in includes:
59                     if re.findall(include, f):
60                         add.append(join(parent, f))
61                 res.extend(add)
62         final_list = []
63         # Exclude things that matches an exclude pattern
64         for ex in excludes:
65             for file in res:
66                 if not re.findall(ex, file):
67                     final_list.append(file)
68         return final_list
69 
70     def run(self):
71         delete_patterns = [
72             ".eggs",
73             ".egg-info",
74             ".pytest_cache",
75             "build",
76             "dist",
77             "__pycache__",
78             ".pyc",
79         ]
80         deletion_list = CleanCommand.find(
81             ".", includes=delete_patterns, excludes=["\\.nox/.*"]
82         )
83 
84         for f in deletion_list:
85             if exists(f):
86                 if isdir(f):
87                     shutil.rmtree(f, ignore_errors=True)
88                 else:
89                     os.unlink(f)
90 
91 
92 with open("README.md", "r") as fh:
93     LONG_DESC = fh.read()
94     setup(
95         cmdclass={"clean": CleanCommand},
96         name="hydra-core",
97         version=find_version("hydra", "__init__.py"),
98         author="Omry Yadan",
99         author_email="omry@fb.com",
100         description="A framework for elegantly configuring complex applications",
101         long_description=LONG_DESC,
102         long_description_content_type="text/markdown",
103         url="https://github.com/facebookresearch/hydra",
104         keywords="command-line configuration yaml tab-completion",
105         packages=find_packages(),
106         include_package_data=True,
107         classifiers=[
108             "License :: OSI Approved :: MIT License",
109             "Development Status :: 4 - Beta",
110             "Programming Language :: Python :: 3.6",
111             "Programming Language :: Python :: 3.7",
112             "Programming Language :: Python :: 3.8",
113             "Operating System :: POSIX :: Linux",
114             "Operating System :: MacOS",
115             "Operating System :: Microsoft :: Windows",
116         ],
117         install_requires=install_requires,
118         # Install development dependencies with
119         # pip install -r requirements/dev.txt -e .
120     )
121
```
--- 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/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -102,7 +102,7 @@
         long_description_content_type="text/markdown",
         url="https://github.com/facebookresearch/hydra",
         keywords="command-line configuration yaml tab-completion",
-        packages=find_packages(),
+        packages=find_packages(include=["hydra"]),
         include_package_data=True,
         classifiers=[
             "License :: OSI Approved :: MIT License",

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -102,7 +102,7 @@\n         long_description_content_type=\"text/markdown\",\n         url=\"https://github.com/facebookresearch/hydra\",\n         keywords=\"command-line configuration yaml tab-completion\",\n-        packages=find_packages(),\n+        packages=find_packages(include=[\"hydra\"]),\n         include_package_data=True,\n         classifiers=[\n             \"License :: OSI Approved :: MIT License\",\n", "issue": "[Bug] setuptools finds and installs tests/ as a top-level package in site-packages/\n\n", "before_files": [{"content": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n# type: ignore\nimport codecs\nimport os\nimport pathlib\nimport re\nimport shutil\nfrom distutils import cmd\nfrom os.path import exists, isdir, join\nfrom typing import Any, List\n\nimport pkg_resources\nfrom setuptools import find_packages, setup\n\nhere = os.path.abspath(os.path.dirname(__file__))\n\n\ndef read(*parts):\n    with codecs.open(os.path.join(here, *parts), \"r\") as fp:\n        return fp.read()\n\n\ndef find_version(*file_paths):\n    version_file = read(*file_paths)\n    version_match = re.search(r\"^__version__ = ['\\\"]([^'\\\"]*)['\\\"]\", version_file, re.M)\n    if version_match:\n        return version_match.group(1)\n    raise RuntimeError(\"Unable to find version string.\")\n\n\nwith pathlib.Path(\"requirements/requirements.txt\").open() as requirements_txt:\n    install_requires = [\n        str(requirement)\n        for requirement in pkg_resources.parse_requirements(requirements_txt)\n    ]\n\n\nclass CleanCommand(cmd.Command):\n    \"\"\"\n    Our custom command to clean out junk files.\n    \"\"\"\n\n    description = \"Cleans out junk files we don't want in the repo\"\n    user_options: List[Any] = []\n\n    def initialize_options(self):\n        pass\n\n    def finalize_options(self):\n        pass\n\n    @staticmethod\n    def find(root, includes, excludes=[]):\n        res = []\n        for parent, dirs, files in os.walk(root):\n            for f in dirs + files:\n                add = list()\n                for include in includes:\n                    if re.findall(include, f):\n                        add.append(join(parent, f))\n                res.extend(add)\n        final_list = []\n        # Exclude things that matches an exclude pattern\n        for ex in excludes:\n            for file in res:\n                if not re.findall(ex, file):\n                    final_list.append(file)\n        return final_list\n\n    def run(self):\n        delete_patterns = [\n            \".eggs\",\n            \".egg-info\",\n            \".pytest_cache\",\n            \"build\",\n            \"dist\",\n            \"__pycache__\",\n            \".pyc\",\n        ]\n        deletion_list = CleanCommand.find(\n            \".\", includes=delete_patterns, excludes=[\"\\\\.nox/.*\"]\n        )\n\n        for f in deletion_list:\n            if exists(f):\n                if isdir(f):\n                    shutil.rmtree(f, ignore_errors=True)\n                else:\n                    os.unlink(f)\n\n\nwith open(\"README.md\", \"r\") as fh:\n    LONG_DESC = fh.read()\n    setup(\n        cmdclass={\"clean\": CleanCommand},\n        name=\"hydra-core\",\n        version=find_version(\"hydra\", \"__init__.py\"),\n        author=\"Omry Yadan\",\n        author_email=\"omry@fb.com\",\n        description=\"A framework for elegantly configuring complex applications\",\n        long_description=LONG_DESC,\n        long_description_content_type=\"text/markdown\",\n        url=\"https://github.com/facebookresearch/hydra\",\n        keywords=\"command-line configuration yaml tab-completion\",\n        packages=find_packages(),\n        include_package_data=True,\n        classifiers=[\n            \"License :: OSI Approved :: MIT License\",\n            \"Development Status :: 4 - Beta\",\n            \"Programming Language :: Python :: 3.6\",\n            \"Programming Language :: Python :: 3.7\",\n            \"Programming Language :: Python :: 3.8\",\n            \"Operating System :: POSIX :: Linux\",\n            \"Operating System :: MacOS\",\n            \"Operating System :: Microsoft :: Windows\",\n        ],\n        install_requires=install_requires,\n        # Install development dependencies with\n        # pip install -r requirements/dev.txt -e .\n    )\n", "path": "setup.py"}], "after_files": [{"content": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n# type: ignore\nimport codecs\nimport os\nimport pathlib\nimport re\nimport shutil\nfrom distutils import cmd\nfrom os.path import exists, isdir, join\nfrom typing import Any, List\n\nimport pkg_resources\nfrom setuptools import find_packages, setup\n\nhere = os.path.abspath(os.path.dirname(__file__))\n\n\ndef read(*parts):\n    with codecs.open(os.path.join(here, *parts), \"r\") as fp:\n        return fp.read()\n\n\ndef find_version(*file_paths):\n    version_file = read(*file_paths)\n    version_match = re.search(r\"^__version__ = ['\\\"]([^'\\\"]*)['\\\"]\", version_file, re.M)\n    if version_match:\n        return version_match.group(1)\n    raise RuntimeError(\"Unable to find version string.\")\n\n\nwith pathlib.Path(\"requirements/requirements.txt\").open() as requirements_txt:\n    install_requires = [\n        str(requirement)\n        for requirement in pkg_resources.parse_requirements(requirements_txt)\n    ]\n\n\nclass CleanCommand(cmd.Command):\n    \"\"\"\n    Our custom command to clean out junk files.\n    \"\"\"\n\n    description = \"Cleans out junk files we don't want in the repo\"\n    user_options: List[Any] = []\n\n    def initialize_options(self):\n        pass\n\n    def finalize_options(self):\n        pass\n\n    @staticmethod\n    def find(root, includes, excludes=[]):\n        res = []\n        for parent, dirs, files in os.walk(root):\n            for f in dirs + files:\n                add = list()\n                for include in includes:\n                    if re.findall(include, f):\n                        add.append(join(parent, f))\n                res.extend(add)\n        final_list = []\n        # Exclude things that matches an exclude pattern\n        for ex in excludes:\n            for file in res:\n                if not re.findall(ex, file):\n                    final_list.append(file)\n        return final_list\n\n    def run(self):\n        delete_patterns = [\n            \".eggs\",\n            \".egg-info\",\n            \".pytest_cache\",\n            \"build\",\n            \"dist\",\n            \"__pycache__\",\n            \".pyc\",\n        ]\n        deletion_list = CleanCommand.find(\n            \".\", includes=delete_patterns, excludes=[\"\\\\.nox/.*\"]\n        )\n\n        for f in deletion_list:\n            if exists(f):\n                if isdir(f):\n                    shutil.rmtree(f, ignore_errors=True)\n                else:\n                    os.unlink(f)\n\n\nwith open(\"README.md\", \"r\") as fh:\n    LONG_DESC = fh.read()\n    setup(\n        cmdclass={\"clean\": CleanCommand},\n        name=\"hydra-core\",\n        version=find_version(\"hydra\", \"__init__.py\"),\n        author=\"Omry Yadan\",\n        author_email=\"omry@fb.com\",\n        description=\"A framework for elegantly configuring complex applications\",\n        long_description=LONG_DESC,\n        long_description_content_type=\"text/markdown\",\n        url=\"https://github.com/facebookresearch/hydra\",\n        keywords=\"command-line configuration yaml tab-completion\",\n        packages=find_packages(include=[\"hydra\"]),\n        include_package_data=True,\n        classifiers=[\n            \"License :: OSI Approved :: MIT License\",\n            \"Development Status :: 4 - Beta\",\n            \"Programming Language :: Python :: 3.6\",\n            \"Programming Language :: Python :: 3.7\",\n            \"Programming Language :: Python :: 3.8\",\n            \"Operating System :: POSIX :: Linux\",\n            \"Operating System :: MacOS\",\n            \"Operating System :: Microsoft :: Windows\",\n        ],\n        install_requires=install_requires,\n        # Install development dependencies with\n        # pip install -r requirements/dev.txt -e .\n    )\n", "path": "setup.py"}]}