diff options
author | Éric Araujo <merwok@netwok.org> | 2011-08-20 05:34:43 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-08-20 05:34:43 (GMT) |
commit | 746e72d59c958bba39d8e755f4cda38010790478 (patch) | |
tree | 38c0fd47049ad6a4c1cb8bcf88283a775175752c /Lib/packaging | |
parent | 60b0d31e35238275ef9f72ca1be71e4efae88fc2 (diff) | |
download | cpython-746e72d59c958bba39d8e755f4cda38010790478.zip cpython-746e72d59c958bba39d8e755f4cda38010790478.tar.gz cpython-746e72d59c958bba39d8e755f4cda38010790478.tar.bz2 |
Rework test_old_record a bit to make the test more exact
(i.e. to check the files found are what we expect)
Diffstat (limited to 'Lib/packaging')
-rw-r--r-- | Lib/packaging/tests/test_command_install_dist.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Lib/packaging/tests/test_command_install_dist.py b/Lib/packaging/tests/test_command_install_dist.py index 7821a3a..c06a3c3 100644 --- a/Lib/packaging/tests/test_command_install_dist.py +++ b/Lib/packaging/tests/test_command_install_dist.py @@ -2,22 +2,19 @@ import os import sys - from sysconfig import (get_scheme_names, get_config_vars, _SCHEMES, get_config_var, get_path) -_CONFIG_VARS = get_config_vars() - -from packaging.tests import captured_stdout - from packaging.command.install_dist import install_dist -from packaging.command import install_dist as install_module from packaging.dist import Distribution from packaging.errors import PackagingOptionError from packaging.tests import unittest, support +_CONFIG_VARS = get_config_vars() + + class InstallTestCase(support.TempdirManager, support.LoggingCatcher, unittest.TestCase): @@ -178,21 +175,24 @@ class InstallTestCase(support.TempdirManager, def test_old_record(self): # test pre-PEP 376 --record option (outside dist-info dir) install_dir = self.mkdtemp() - pkgdir, dist = self.create_dist() + project_dir, dist = self.create_dist(scripts=['hello']) + #self.addCleanup(os.chdir, os.getcwd()) + os.chdir(project_dir) + self.write_file('hello', "print('o hai')") - dist = Distribution() cmd = install_dist(dist) dist.command_obj['install_dist'] = cmd cmd.root = install_dir - cmd.record = os.path.join(pkgdir, 'filelist') + cmd.record = os.path.join(project_dir, 'filelist') cmd.ensure_finalized() cmd.run() - # let's check the record file was created with four - # lines, one for each .dist-info entry: METADATA, - # INSTALLER, REQUSTED, RECORD with open(cmd.record) as f: - self.assertEqual(len(f.readlines()), 4) + content = f.read() + + found = [os.path.basename(line) for line in content.splitlines()] + expected = ['hello', 'METADATA', 'INSTALLER', 'REQUESTED', 'RECORD'] + self.assertEqual(found, expected) # XXX test that fancy_getopt is okay with options named # record and no-record but unrelated |