@@ -208,76 +208,6 @@ def test_missing_required_metadata(self):
208208 unversioned .version
209209
210210
211- class MultipleVersionsTests (fixtures .OnSysPath , fixtures .SiteDir , unittest .TestCase ):
212- """
213- An unclean upgrade can leave more than one metadata directory for a
214- distribution in one path. Prefer the greater one.
215-
216- Ref python/cpython#100666.
217- """
218-
219- # Deliberately not in version order; the preference follows the
220- # lexicographic ordering of the directory names, which only
221- # approximates the ordering of the versions they name.
222- versions = '1.12.1' , '1.13.1' , '1.9.0' , '2.0.0'
223- expected = '2.0.0' , '1.9.0' , '1.13.1' , '1.12.1'
224-
225- @staticmethod
226- def make_pkg (name , version , files = None ):
227- """
228- Create metadata for a dist-info package at the indicated version.
229- """
230- return {
231- f'{ name } -{ version } .dist-info' : (
232- {'METADATA' : f'Name: { name } \n Version: { version } \n ' }
233- if files is None
234- else files
235- ),
236- }
237-
238- def build_versions (self , * versions ):
239- for ver in versions :
240- fixtures .build_files (self .make_pkg ('foo' , ver ), self .site_dir )
241-
242- def test_greater_version_preferred (self ):
243- """
244- Retrieving by name resolves to the greater version.
245- """
246- self .build_versions (* self .versions )
247- assert version ('foo' ) == self .expected [0 ]
248-
249- def test_discovery_order (self ):
250- """
251- Preferring one version doesn't hide the others from discovery,
252- which reports them greatest first.
253- """
254- self .build_versions (* self .versions )
255- found = tuple (dist .version for dist in Distribution .discover (name = 'foo' ))
256- assert found == self .expected
257-
258- def test_greater_version_preferred_in_eggs (self ):
259- """
260- Legacy egg-info metadata gets the same preference.
261- """
262- fixtures .build_files (
263- {
264- f'foo-{ ver } .egg-info' : {'PKG-INFO' : f'Name: foo\n Version: { ver } \n ' }
265- for ver in self .versions
266- },
267- self .site_dir ,
268- )
269- assert version ('foo' ) == self .expected [0 ]
270-
271- def test_validity_preferred_to_version (self ):
272- """
273- A valid dist is still preferred to an invalid one of a greater
274- version, the condition that prompted the report.
275- """
276- self .build_versions ('1.12.1' )
277- fixtures .build_files (self .make_pkg ('foo' , '2.0.0' , files = {}), self .site_dir )
278- assert version ('foo' ) == '1.12.1'
279-
280-
281211class NonASCIITests (fixtures .OnSysPath , fixtures .SiteDir , unittest .TestCase ):
282212 @staticmethod
283213 def pkg_with_non_ascii_description (site_dir ):
0 commit comments