Commits

Anonymous committed 81b9058

project: fixed updating file list in _FileListCacher

Comments (0)

Files changed (2)

rope/base/project.py

             if self.observer is None:
                 self._init_observer()
             self._list = self._get_files_recursively(self.project.root)
-            folders = [resource for resource in self._list
-                       if resource.is_folder()]
+            folders = self._get_folders_recursively(self.project.root)
             for resource in folders:
                 self.observer.add_resource(resource)
         return self._list
             result.update(self._get_files_recursively(child))
         return result
 
+    def _get_folders_recursively(self, folder):
+        result = set()
+        result.add(folder)
+        for child in folder.get_folders():
+            result.update(self._get_files_recursively(child))
+        return result
+
     def _init_observer(self):
         if self.observer is None:
             self.rawobserver = ResourceObserver(

ropetest/projecttest.py

         self.assertEquals(file2, sample_observer.last_created)
         self.assertEquals((file1, file2), sample_observer.last_moved)
 
+    def test_validating_get_files_list(self):
+        root = self.project.root
+        self.assertEquals(0, len(self.project.get_files()))
+        file = open(os.path.join(self.project.address, 'myfile.txt'), 'w')
+        file.close()
+        self.project.validate()
+        self.assertEquals(1, len(self.project.get_files()))
+
 
 class _MockChangeIndicator(object):