[Python-checkins] distutils2: First test on the distinfo_dirname function.

tarek.ziade python-checkins at python.org
Mon Apr 5 23:09:19 CEST 2010


tarek.ziade pushed f9f9bc7f7a98 to distutils2:

http://hg.python.org/distutils2/rev/f9f9bc7f7a98
changeset:   90:f9f9bc7f7a98
user:        pumazi
date:        Tue Mar 30 20:59:16 2010 -0400
summary:     First test on the distinfo_dirname function.
files:       src/distutils2/_backport/pkgutil.py, src/distutils2/_backport/tests/test_pkgutil.py

diff --git a/src/distutils2/_backport/pkgutil.py b/src/distutils2/_backport/pkgutil.py
--- a/src/distutils2/_backport/pkgutil.py
+++ b/src/distutils2/_backport/pkgutil.py
@@ -682,7 +682,8 @@
     :type version: string
     :returns: directory name
     :rtype: string"""
-    pass
+    file_extension = '.dist-info'
+    return '-'.join([name, version]) + file_extension
 
 def get_distributions():
     """
diff --git a/src/distutils2/_backport/tests/test_pkgutil.py b/src/distutils2/_backport/tests/test_pkgutil.py
--- a/src/distutils2/_backport/tests/test_pkgutil.py
+++ b/src/distutils2/_backport/tests/test_pkgutil.py
@@ -17,8 +17,17 @@
     # def tearDown(self):
     #     super(TestPkgUtil, self).tearDown()
 
-    def test_something(self):
-        pass
+    def test_distinfo_dirname(self):
+        """Given a name and a version, we expect the distinfo_dirname function
+        to return a standard distribution information directory name."""
+        # Test for a very simple single word name and decimal version number
+        name = 'docutils'
+        version = '0.5'
+        standard_dirname = 'docutils-0.5.dist-info'
+
+        from distutils2._backport.pkgutil import distinfo_dirname
+        dirname = distinfo_dirname(name, version)
+        self.assertEqual(dirname, standard_dirname)
 
 
 def test_suite():

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list