diff options
| author | Kelsey Hightower <kelsey.hightower@gmail.com> | 2011-02-13 12:09:44 -0500 |
|---|---|---|
| committer | Kelsey Hightower <kelsey.hightower@gmail.com> | 2011-02-13 12:09:44 -0500 |
| commit | dc5bb384d38de36ad539fe62343f117cfca74df3 (patch) | |
| tree | cfb4706a7238e400f2668aed19866e6a92220765 | |
| parent | a5993f46d3c5598493d54d52d135889be3a9a267 (diff) | |
| download | disutils2-dc5bb384d38de36ad539fe62343f117cfca74df3.tar.gz | |
Fixing a bug in distutils2.index.dist.DistInfo.unpack; does not unpack into the path specified in the path argument.
| -rw-r--r-- | distutils2/index/dist.py | 2 | ||||
| -rw-r--r-- | distutils2/tests/test_index_dist.py | 22 |
2 files changed, 17 insertions, 7 deletions
diff --git a/distutils2/index/dist.py b/distutils2/index/dist.py index b03492b..233eec7 100644 --- a/distutils2/index/dist.py +++ b/distutils2/index/dist.py @@ -324,7 +324,7 @@ class DistInfo(IndexReference): filename = self.download(path) content_type = mimetypes.guess_type(filename)[0] - self._unpacked_dir = unpack_archive(filename) + self._unpacked_dir = unpack_archive(filename, path) return self._unpacked_dir diff --git a/distutils2/tests/test_index_dist.py b/distutils2/tests/test_index_dist.py index 09ae3d3..ac6a377 100644 --- a/distutils2/tests/test_index_dist.py +++ b/distutils2/tests/test_index_dist.py @@ -160,13 +160,23 @@ class TestDistInfo(TempdirManager, unittest.TestCase): @use_pypi_server('downloads_with_md5') def test_unpack(self, server): url = "%s/simple/foobar/foobar-0.1.tar.gz" % server.full_address - dist = Dist(url=url) + dist1 = Dist(url=url) # doing an unpack - here = self.mkdtemp() - there = dist.unpack(here) - result = os.listdir(there) - self.assertIn('paf', result) - os.remove('paf') + dist1_here = self.mkdtemp() + dist1_there = dist1.unpack(path=dist1_here) + # assert we unpack to the path provided + self.assertEqual(dist1_here, dist1_there) + dist1_result = os.listdir(dist1_there) + self.assertIn('paf', dist1_result) + os.remove(os.path.join(dist1_there, 'paf')) + + # Test unpack works without a path argument + dist2 = Dist(url=url) + # doing an unpack + dist2_there = dist2.unpack() + dist2_result = os.listdir(dist2_there) + self.assertIn('paf', dist2_result) + os.remove(os.path.join(dist2_there, 'paf')) def test_hashname(self): # Invalid hashnames raises an exception on assignation |
