Fix sdist to always include setup.cfg (#11092), to comply with the spec

This commit is contained in:
Éric Araujo 2011-06-06 21:55:43 +02:00
parent 078368fe4d
commit 7373fccd50
3 changed files with 32 additions and 19 deletions

View file

@ -34,6 +34,7 @@ setup(name='fake')
MANIFEST = """\
# file GENERATED by packaging, do NOT edit
inroot.txt
setup.cfg
data%(sep)sdata.dt
scripts%(sep)sscript.py
some%(sep)sfile.txt
@ -173,6 +174,7 @@ class SDistTestCase(support.TempdirManager,
# in package_data
dist.package_data = {'': ['*.cfg', '*.dat'],
'somecode': ['*.txt']}
self.write_file((self.tmp_dir, 'setup.cfg'), '#')
self.write_file((self.tmp_dir, 'somecode', 'doc.txt'), '#')
self.write_file((self.tmp_dir, 'somecode', 'doc.dat'), '#')
@ -212,8 +214,8 @@ class SDistTestCase(support.TempdirManager,
content = zip_file.namelist()
# Making sure everything was added. This includes 8 code and data
# files in addition to PKG-INFO.
self.assertEqual(len(content), 9)
# files in addition to PKG-INFO and setup.cfg
self.assertEqual(len(content), 10)
# Checking the MANIFEST
with open(join(self.tmp_dir, 'MANIFEST')) as fp:
@ -230,7 +232,7 @@ class SDistTestCase(support.TempdirManager,
cmd.ensure_finalized()
cmd.run()
warnings = self.get_logs(logging.WARN)
self.assertEqual(len(warnings), 3)
self.assertEqual(len(warnings), 4)
# trying with a complete set of metadata
self.loghandler.flush()
@ -242,8 +244,9 @@ class SDistTestCase(support.TempdirManager,
# removing manifest generated warnings
warnings = [warn for warn in warnings if
not warn.endswith('-- skipping')]
# the remaining warning is about the use of the default file list
self.assertEqual(len(warnings), 1)
# the remaining warnings are about the use of the default file list and
# the absence of setup.cfg
self.assertEqual(len(warnings), 2)
def test_show_formats(self):
__, stdout = captured_stdout(show_formats)