@@ -226,16 +226,18 @@ def test_diff_leave_packaging_packages_alone(fake_dist, from_line):
226226 assert to_uninstall == {"first" }
227227
228228
229- def test_diff_leave_piptools_alone (fake_dist , from_line ):
229+ def test_diff_leave_piptools_and_its_dependencies_alone (fake_dist , from_line ):
230230 # Suppose an env contains Django, and pip-tools itself (including all of
231231 # its dependencies)
232232 installed = [
233233 fake_dist ("django==1.7" ),
234234 fake_dist ("first==2.0.1" ),
235- fake_dist ("pip-tools==1.1.1" , ["click>=4" , "first" , "six" ]),
235+ fake_dist ("pip-tools==1.1.1" , ["click>=4" , "first" , "six" , "build" ]),
236236 fake_dist ("six==1.9.0" ),
237237 fake_dist ("click==4.1" ),
238238 fake_dist ("foobar==0.3.6" ),
239+ fake_dist ("build==0.10.0" , ["pyproject_hooks" ]),
240+ fake_dist ("pyproject_hooks==1.0.0" ),
239241 ]
240242
241243 # Then this Django-only requirement should keep pip around (i.e. NOT
@@ -274,6 +276,27 @@ def test_diff_with_matching_url_hash(fake_dist, from_line):
274276 assert to_uninstall == set ()
275277
276278
279+ @pytest .mark .parametrize (
280+ ("installed_dist" , "compiled_req" ),
281+ (
282+ pytest .param ("Django==1.7" , "django==1.7" , id = "case insensitive" ),
283+ pytest .param (
284+ "jaraco.classes==3.2" ,
285+ "jaraco-classes==3.2" ,
286+ id = "different namespace notation" ,
287+ ),
288+ ),
289+ )
290+ def test_diff_respects_canonical_package_names (
291+ fake_dist , from_line , installed_dist , compiled_req
292+ ):
293+ installed = [fake_dist (installed_dist )]
294+ reqs = [from_line (compiled_req )]
295+ to_install , to_uninstall = diff (reqs , installed )
296+ assert to_install == set ()
297+ assert to_uninstall == set ()
298+
299+
277300def test_diff_with_no_url_hash (fake_dist , from_line ):
278301 # if URL hash is not provided, assume the contents have
279302 # changed and reinstall
0 commit comments