diff options
author | Éric Araujo <merwok@netwok.org> | 2011-06-16 21:43:15 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-06-16 21:43:15 (GMT) |
commit | 6f67765389f63b49c094ee08017309bcb45d7ed6 (patch) | |
tree | af25aaec48f44dfb11bac27c5919e6884f7249d3 /Lib/packaging/tests/test_database.py | |
parent | b6be20ca337348b7cf2b356f9354a4121627add0 (diff) | |
download | cpython-6f67765389f63b49c094ee08017309bcb45d7ed6.zip cpython-6f67765389f63b49c094ee08017309bcb45d7ed6.tar.gz cpython-6f67765389f63b49c094ee08017309bcb45d7ed6.tar.bz2 |
Stop binding sys.path as default parameter value in packaging.
The two public functions in database default to sys.path if the given
*paths* argument is None; the private functions don’t have default
values for their arguments anymore, which is fine as the public
functions that call them pass their arguments down. Likewise in
install, the functions will pass down their *paths* arguments down to
database functions.
A one-line unneeded function in install was removed instead of being
changed, and the few remaining tests that used brute-force restoration
of sys.path have been cleaned up to use sys.path.remove.
Diffstat (limited to 'Lib/packaging/tests/test_database.py')
-rw-r--r-- | Lib/packaging/tests/test_database.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/packaging/tests/test_database.py b/Lib/packaging/tests/test_database.py index e965c60..3eeda83 100644 --- a/Lib/packaging/tests/test_database.py +++ b/Lib/packaging/tests/test_database.py @@ -259,12 +259,11 @@ class TestDatabase(support.LoggingCatcher, disable_cache() # Setup the path environment with our fake distributions current_path = os.path.abspath(os.path.dirname(__file__)) - self.sys_path = sys.path[:] self.fake_dists_path = os.path.join(current_path, 'fake_dists') sys.path.insert(0, self.fake_dists_path) def tearDown(self): - sys.path[:] = self.sys_path + sys.path.remove(self.fake_dists_path) enable_cache() super(TestDatabase, self).tearDown() @@ -488,20 +487,20 @@ class TestDatabase(support.LoggingCatcher, dists = [('choxie', '2.0.0.9'), ('grammar', '1.0a4'), ('towel-stuff', '0.1'), ('babar', '0.1')] - checkLists([], _yield_distributions(False, False)) + checkLists([], _yield_distributions(False, False, sys.path)) found = [(dist.name, dist.metadata['Version']) - for dist in _yield_distributions(False, True) + for dist in _yield_distributions(False, True, sys.path) if dist.path.startswith(self.fake_dists_path)] checkLists(eggs, found) found = [(dist.name, dist.metadata['Version']) - for dist in _yield_distributions(True, False) + for dist in _yield_distributions(True, False, sys.path) if dist.path.startswith(self.fake_dists_path)] checkLists(dists, found) found = [(dist.name, dist.metadata['Version']) - for dist in _yield_distributions(True, True) + for dist in _yield_distributions(True, True, sys.path) if dist.path.startswith(self.fake_dists_path)] checkLists(dists + eggs, found) |