Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ced7eda

Browse files
committed
Another (hopefully last) fix for test_packaging on Windws (#12678)
1 parent 0a95b43 commit ced7eda

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

Lib/packaging/tests/test_command_install_distinfo.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def test_record_basic(self):
138138
os.chdir(project_dir)
139139
self.write_file('spam', '# Python module')
140140
self.write_file('spamd', '# Python script')
141-
extmod = '_speedspam%s' % sysconfig.get_config_var('SO')
141+
extmod = '_speedspam' + sysconfig.get_config_var('SO')
142142
self.write_file(extmod, '')
143143

144144
install = DummyInstallCmd(dist)
@@ -152,6 +152,16 @@ def test_record_basic(self):
152152
dist.command_obj['install_distinfo'] = cmd
153153
cmd.run()
154154

155+
# checksum and size are not hard-coded for METADATA as it is
156+
# platform-dependent (line endings)
157+
metadata = os.path.join(modules_dest, 'Spamlib-0.1.dist-info',
158+
'METADATA')
159+
with open(metadata, 'rb') as fp:
160+
content = fp.read()
161+
162+
metadata_size = str(len(content))
163+
metadata_md5 = hashlib.md5(content).hexdigest()
164+
155165
record = os.path.join(modules_dest, 'Spamlib-0.1.dist-info', 'RECORD')
156166
with open(record, encoding='utf-8') as fp:
157167
content = fp.read()
@@ -164,9 +174,9 @@ def test_record_basic(self):
164174

165175
expected = [
166176
('spam', '6ab2f288ef2545868effe68757448b45', '15'),
167-
('spamd','d13e6156ce78919a981e424b2fdcd974', '15'),
177+
('spamd', 'd13e6156ce78919a981e424b2fdcd974', '15'),
168178
(extmod, 'd41d8cd98f00b204e9800998ecf8427e', '0'),
169-
('METADATA', '846de67e49c3b92c81fb1ebd7bc07046', '172'),
179+
('METADATA', metadata_md5, metadata_size),
170180
('INSTALLER', '44e3fde05f3f537ed85831969acf396d', '9'),
171181
('REQUESTED', 'd41d8cd98f00b204e9800998ecf8427e', '0'),
172182
('RECORD', '', ''),

0 commit comments

Comments
 (0)