diff options
Diffstat (limited to 'Lib/distutils/tests/test_sdist.py')
-rw-r--r-- | Lib/distutils/tests/test_sdist.py | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/Lib/distutils/tests/test_sdist.py b/Lib/distutils/tests/test_sdist.py index d0d16b2..fd71dac 100644 --- a/Lib/distutils/tests/test_sdist.py +++ b/Lib/distutils/tests/test_sdist.py @@ -7,6 +7,12 @@ import zipfile from os.path import join from textwrap import dedent +try: + import zlib + ZLIB_SUPPORT = True +except ImportError: + ZLIB_SUPPORT = False + from test.support import captured_stdout, check_warnings, run_unittest from distutils.command.sdist import sdist, show_formats @@ -28,6 +34,7 @@ setup(name='fake') MANIFEST = """\ # file GENERATED by distutils, do NOT edit README +buildout.cfg inroot.txt setup.py data%(sep)sdata.dt @@ -39,13 +46,6 @@ somecode%(sep)sdoc.dat somecode%(sep)sdoc.txt """ -try: - import zlib - ZLIB_SUPPORT = True -except ImportError: - ZLIB_SUPPORT = False - - class SDistTestCase(PyPIRCCommandTestCase): def setUp(self): @@ -143,7 +143,7 @@ class SDistTestCase(PyPIRCCommandTestCase): dist_folder = join(self.tmp_dir, 'dist') result = os.listdir(dist_folder) result.sort() - self.assertEqual(result, ['fake-1.0.tar', 'fake-1.0.tar.gz'] ) + self.assertEqual(result, ['fake-1.0.tar', 'fake-1.0.tar.gz']) os.remove(join(dist_folder, 'fake-1.0.tar')) os.remove(join(dist_folder, 'fake-1.0.tar.gz')) @@ -180,11 +180,18 @@ class SDistTestCase(PyPIRCCommandTestCase): self.write_file((data_dir, 'data.dt'), '#') some_dir = join(self.tmp_dir, 'some') os.mkdir(some_dir) + # make sure VCS directories are pruned (#14004) + hg_dir = join(self.tmp_dir, '.hg') + os.mkdir(hg_dir) + self.write_file((hg_dir, 'last-message.txt'), '#') + # a buggy regex used to prevent this from working on windows (#6884) + self.write_file((self.tmp_dir, 'buildout.cfg'), '#') self.write_file((self.tmp_dir, 'inroot.txt'), '#') self.write_file((some_dir, 'file.txt'), '#') self.write_file((some_dir, 'other_file.txt'), '#') dist.data_files = [('data', ['data/data.dt', + 'buildout.cfg', 'inroot.txt', 'notexisting']), 'some/file.txt', @@ -214,15 +221,15 @@ class SDistTestCase(PyPIRCCommandTestCase): zip_file.close() # making sure everything was added - self.assertEqual(len(content), 11) + self.assertEqual(len(content), 12) # checking the MANIFEST f = open(join(self.tmp_dir, 'MANIFEST')) try: manifest = f.read() - self.assertEqual(manifest, MANIFEST % {'sep': os.sep}) finally: f.close() + self.assertEqual(manifest, MANIFEST % {'sep': os.sep}) @unittest.skipUnless(ZLIB_SUPPORT, 'Need zlib support to run') def test_metadata_check_option(self): |