@@ -209,6 +209,8 @@ def test_existing_over_wheel_priority(self, data):
209
209
with pytest .raises (BestVersionAlreadyInstalled ):
210
210
finder .find_requirement (req , True )
211
211
212
+
213
+ class TestCandidateEvaluator :
212
214
def test_link_sorting (self ):
213
215
"""
214
216
Test link sorting
@@ -249,7 +251,8 @@ def test_link_sorting(self):
249
251
results = sorted (links , key = sort_key , reverse = True )
250
252
results2 = sorted (reversed (links ), key = sort_key , reverse = True )
251
253
252
- assert links == results == results2 , results2
254
+ assert links == results , results
255
+ assert links == results2 , results2
253
256
254
257
def test_link_sorting_wheels_with_build_tags (self ):
255
258
"""Verify build tags affect sorting."""
@@ -274,7 +277,47 @@ def test_link_sorting_wheels_with_build_tags(self):
274
277
sort_key = candidate_evaluator ._sort_key
275
278
results = sorted (links , key = sort_key , reverse = True )
276
279
results2 = sorted (reversed (links ), key = sort_key , reverse = True )
277
- assert links == results == results2 , results2
280
+
281
+ assert links == results , results
282
+ assert links == results2 , results2
283
+
284
+ def test_build_tag_is_less_important_than_other_tags (self ):
285
+ links = [
286
+ InstallationCandidate (
287
+ "simple" ,
288
+ "1.0" ,
289
+ Link ('simple-1.0-1-py3-abi3-linux_x86_64.whl' ),
290
+ ),
291
+ InstallationCandidate (
292
+ "simple" ,
293
+ '1.0' ,
294
+ Link ('simple-1.0-2-py3-abi3-linux_i386.whl' ),
295
+ ),
296
+ InstallationCandidate (
297
+ "simple" ,
298
+ '1.0' ,
299
+ Link ('simple-1.0-2-py3-any-none.whl' ),
300
+ ),
301
+ InstallationCandidate (
302
+ "simple" ,
303
+ '1.0' ,
304
+ Link ('simple-1.0.tar.gz' ),
305
+ ),
306
+ ]
307
+ valid_tags = [
308
+ Tag ('py3' , 'abi3' , 'linux_x86_64' ),
309
+ Tag ('py3' , 'abi3' , 'linux_i386' ),
310
+ Tag ('py3' , 'any' , 'none' ),
311
+ ]
312
+ evaluator = CandidateEvaluator (
313
+ 'my-project' , supported_tags = valid_tags , specifier = SpecifierSet (),
314
+ )
315
+ sort_key = evaluator ._sort_key
316
+ results = sorted (links , key = sort_key , reverse = True )
317
+ results2 = sorted (reversed (links ), key = sort_key , reverse = True )
318
+
319
+ assert links == results , results
320
+ assert links == results2 , results2
278
321
279
322
280
323
def test_finder_priority_file_over_page (data ):
0 commit comments