Repository: jazzband/pip-tools (python)

Issue:
Clean up piptools/_vendored mentions
#### What's the problem this feature will solve?
<!-- What are you trying to do, that you are unable to achieve with pip-tools as it currently stands? -->

Since `piptools/_vendored` does not exist anymore in the codebase, this should be cleaned up:
https://github.com/jazzband/pip-tools/blob/ef529778f90cb1ac0a6affb09e4d9d3fb56c1e76/tests/__init__.py#L1-L2
https://github.com/jazzband/pip-tools/blob/ef529778f90cb1ac0a6affb09e4d9d3fb56c1e76/.coveragerc#L6
https://github.com/jazzband/pip-tools/blob/ef529778f90cb1ac0a6affb09e4d9d3fb56c1e76/setup.cfg#L8

#### Describe the solution you'd like
<!-- A clear and concise description of what you want to happen. -->

1. clean up `tests/__init__.py`
1. remove `piptools/_vendored` mentions in [setup.cfg](https://github.com/jazzband/pip-tools/blob/ef529778f90cb1ac0a6affb09e4d9d3fb56c1e76/setup.cfg#L8) and [.coveragerc](https://github.com/jazzband/pip-tools/blob/ef529778f90cb1ac0a6affb09e4d9d3fb56c1e76/.coveragerc#L6
)
<!-- Provide examples of real-world use cases that this would enable and how it solves the problem described above. -->

#### Alternative Solutions
<!-- Have you tried to workaround the problem using pip-tools or other tools? Or a different approach to solving this issue? Please elaborate here. -->

N/A

#### Additional context
<!-- Add any other context, links, etc. about the feature here. -->

N/A

---

_This is a good issue for the first time contributors to work on. Feel free to ask any questions, we'd gladly help you make your first contributions._

Pull request:
Clean up piptools/_vendored
<!--- Describe the changes here. --->

Closes #993.

- Remove `piptools/_vendored/*` from `.coveragerc`
- Remove `norecursedirs` from `setup.cfg`
- Remove `import piptools` from `tests/__init__.py`

**Changelog-friendly one-liner**: Clean up piptools/_vendored

##### Contributor checklist

- ~~Provided the tests for the changes.~~
- [x] Gave a clear one-line description in the PR (that the maintainers can add to CHANGELOG.md on release).
- [ ] Assign the PR to an existing or new milestone for the target version (following [Semantic Versioning](https://blog.versioneye.com/2014/01/16/semantic-versioning/)).

Patch:
diff --git a/.coveragerc b/.coveragerc
index 5bac98e..26c6762 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -3,7 +3,6 @@ branch = True
 source = .
 omit =
     piptools/_compat/*
-    piptools/_vendored/*
 
 [report]
 include = piptools/*, tests/*
diff --git a/piptools/repositories/pypi.py b/piptools/repositories/pypi.py
index 50bcc87..b6b7b8a 100644
--- a/piptools/repositories/pypi.py
+++ b/piptools/repositories/pypi.py
@@ -274,10 +274,10 @@ class PyPIRepository(BaseRepository):
                         os.environ["PIP_REQ_TRACKER"] = prev_tracker
                     else:
                         del os.environ["PIP_REQ_TRACKER"]
-                try:
-                    self.wheel_cache.cleanup()
-                except AttributeError:
-                    pass
+
+                # WheelCache.cleanup() introduced in pip==10.0.0
+                if PIP_VERSION >= (10,):
+                    wheel_cache.cleanup()
         return self._dependencies_cache[ireq]
 
     def get_hashes(self, ireq):
diff --git a/setup.cfg b/setup.cfg
index 5b598a2..4dbc5e7 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -5,7 +5,7 @@ universal = 1
 license_file = LICENSE
 
 [tool:pytest]
-norecursedirs = .* build dist venv test_data piptools/_compat/* piptools/_vendored/*
+norecursedirs = .* build dist venv test_data piptools/_compat/*
 testpaths = tests piptools
 filterwarnings =
     ignore::PendingDeprecationWarning:pip\._vendor.+


Test patch:
diff --git a/tests/__init__.py b/tests/__init__.py
index 9bf0cd7..e69de29 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,2 +0,0 @@
-# Trigger an import of piptools, effectively injecting piptools/_vendored in sys.path
-import piptools  # noqa
diff --git a/tests/test_repository_pypi.py b/tests/test_repository_pypi.py
index 8eca3ec..c39b9a5 100644
--- a/tests/test_repository_pypi.py
+++ b/tests/test_repository_pypi.py
@@ -174,3 +174,19 @@ def test_pypirepo_calls_reqset_with_str_paths(pypi_repository, from_line):
         assert isinstance(called_with_finder, PackageFinder)
         assert called_with_ireq == ireq
         assert not pf_call_kwargs
+
+
+@pytest.mark.skipif(
+    PIP_VERSION < (10,), reason="WheelCache.cleanup() introduced in pip==10.0.0"
+)
+@mock.patch("piptools.repositories.pypi.PyPIRepository.resolve_reqs")  # to run offline
+@mock.patch("piptools.repositories.pypi.WheelCache")
+def test_wheel_cache_cleanup_called(
+    WheelCache, resolve_reqs, pypi_repository, from_line
+):
+    """
+    Test WheelCache.cleanup() called once after dependency resolution.
+    """
+    ireq = from_line("six==1.10.0")
+    pypi_repository.get_dependencies(ireq)
+    WheelCache.return_value.cleanup.assert_called_once_with()