File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 11import os
22import sys
33import copy
4+ import json
45import shutil
56import pathlib
67import tempfile
@@ -127,6 +128,31 @@ def make_uppercase(self):
127128 build_files (files , self .site_dir )
128129
129130
131+ class DistInfoPkgEditable (DistInfoPkg ):
132+ """
133+ Package with a PEP 660 direct_url.json.
134+ """
135+
136+ some_hash = '524127ce937f7cb65665130c695abd18ca386f60bb29687efb976faa1596fdcc'
137+ files : FilesSpec = {
138+ 'distinfo_pkg-1.0.0.dist-info' : {
139+ 'direct_url.json' : json .dumps (
140+ {
141+ "archive_info" : {
142+ "hash" : f"sha256={ some_hash } " ,
143+ "hashes" : {"sha256" : f"{ some_hash } " },
144+ },
145+ "url" : "file:///path/to/distinfo_pkg-1.0.0.editable-py3-none-any.whl" ,
146+ }
147+ )
148+ },
149+ }
150+
151+ def setUp (self ):
152+ super ().setUp ()
153+ build_files (DistInfoPkgEditable .files , self .site_dir )
154+
155+
130156class DistInfoPkgWithDot (OnSysPath , SiteDir ):
131157 files : FilesSpec = {
132158 "pkg_dot-1.0.0.dist-info" : {
Original file line number Diff line number Diff line change @@ -457,3 +457,10 @@ def import_names_from_package(package_name):
457457 # sources_fallback-pkg has one import ('sources_fallback') inferred from
458458 # SOURCES.txt (top_level.txt and installed-files.txt is missing)
459459 assert import_names_from_package ('sources_fallback-pkg' ) == {'sources_fallback' }
460+
461+
462+ class EditableDistributionTest (fixtures .DistInfoPkgEditable , unittest .TestCase ):
463+ def test_origin (self ):
464+ dist = Distribution .from_name ('distinfo-pkg' )
465+ assert dist .origin .url .endswith ('.whl' )
466+ assert dist .origin .archive_info .hashes .sha256
You can’t perform that action at this time.
0 commit comments