Anonymous avatar Anonymous committed f5c2fc6

fixed a bug in base.pycore which lead source_folders pref to be unusable

Comments (0)

Files changed (2)

rope/base/pycore.py

     def _init_source_folders(self):
         self._custom_source_folders = []
         for path in self.project.prefs.get('source_folders', []):
-            self._custom_source_folders.append(path)
+            folder = self.project.get_resource(path)
+            self._custom_source_folders.append(folder)
 
     def _init_automatic_soa(self):
         if not self.automatic_soa:

ropetest/pycoretest.py

         found_module = self.pycore.find_module('sample')
         self.assertEquals(samplepkg, found_module)
 
+    def test_source_folders_preference(self):
+        pkg1 = testutils.create_package(self.project, 'pkg1')
+        src2 = testutils.create_package(self.project, 'pkg1.src2')
+        lost = testutils.create_module(self.project, 'pkg1.src2.lost')
+        self.assertEqual(self.project.pycore.find_module('lost'), None)
+        self.project.close()
+        from rope.base.project import Project
+        self.project = Project(self.project.address,
+                               source_folders=['pkg1/src2'])
+        self.assertEqual(self.project.pycore.find_module('lost'), lost)
+
     def test_getting_empty_source_folders(self):
         self.assertEquals([], self.pycore.get_source_folders())
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.