Commits

Vinay Sajip  committed 71cd99e

Corrected typo, included tests with caching disabled.

  • Participants
  • Parent commits ed22a55

Comments (0)

Files changed (3)

File distlib/database.py

                 :class:`EggInfoDistribution` instances
         """
         if not self._cache_enabled:
-            for dist in _yield_distributions(self):
+            for dist in self._yield_distributions():
                 yield dist
         else:
             self._generate_cache()

File tests/test_database.py

         cases = ((d, non_egg_dists, InstalledDistribution),
                  (ed, all_dists, BaseInstalledDistribution))
 
-        for distset, fake_dists, allowed_class in cases:
-            found_dists = []
+        fake_dists_path = self.fake_dists_path
+        for enabled in (True, False):
+            if not enabled:
+                d.disable_cache()
+                ed.disable_cache()
+                d.clear_cache()
+                ed.clear_cache()
 
-            # Verify the fake dists have been found.
-            dists = list(distset.get_distributions())
-            for dist in dists:
-                self.assertIsInstance(dist, allowed_class)
-                if (dist.name in dict(fake_dists) and
-                    dist.path.startswith(self.fake_dists_path)):
-                    found_dists.append((dist.name, dist.version))
-                else:
-                    # check that it doesn't find anything more than this
-                    self.assertFalse(dist.path.startswith(self.fake_dists_path))
-                # otherwise we don't care what other distributions are found
+            for distset, fake_dists, allowed_class in cases:
+                found_dists = []
 
-            # Finally, test that we found all that we were looking for
-            self.assertEqual(sorted(found_dists), sorted(fake_dists))
+                # Verify the fake dists have been found.
+                dists = list(distset.get_distributions())
+                for dist in dists:
+                    self.assertIsInstance(dist, allowed_class)
+                    if (dist.name in dict(fake_dists) and
+                        dist.path.startswith(fake_dists_path)):
+                        found_dists.append((dist.name, dist.version))
+                    else:
+                        # check that it doesn't find anything more than this
+                        self.assertFalse(dist.path.startswith(fake_dists_path))
+                    # otherwise we don't care what other dists are found
+
+                # Finally, test that we found all that we were looking for
+                self.assertEqual(sorted(found_dists), sorted(fake_dists))
 
     @requires_zlib
     def test_get_distribution(self):

File tests/test_scripts.py

                 with open(fn, 'rb') as f:
                     data = f.read()
                 self.assertEqual(data, tlauncher)
-            elif f.startswith('foo') and fn.endswith(('.py', '.pyw')):
+            elif fn.startswith('foo') and fn.endswith(('.py', '.pyw')):
                 with open(fn, 'rb') as f:
                     data = f.readline()
                     self.assertIn(b'python.exe', data)