This patch fixes some minor issues with ctypes-python. Now we are explicitly clearing the pool.
Log [[[ Fix ctypes-python tests by explicitly clearing pool. * subversion/bindings/ctypes-python/csvn/wc.py, subversion/bindings/ctypes-python/csvn/repos.py (WC.clear_pool, LocalRepository.clear_pool, RemoteRepository.clear_pool): New method to clear pool. * subversion/bindings/ctypes-python/test/cw.py, subversion/bindings/ctypes-python/test/localrepos.py, subversion/bindings/ctypes-python/test/remoterepos.py (WCTestCase.setUp, LocalRepositoryTestCase.setUp, RemoteRepositoryTestCase.setUp): Initialize instance variable. (WCTestCase.tearDown, LocalRepositoryTestCase.tearDown, RemoteRepositoryTestCase.tearDown): Clear pool. Patch by: Noorul Islam K M <noorul{_AT_}collab.net> ]]]
Index: subversion/bindings/ctypes-python/test/wc.py =================================================================== --- subversion/bindings/ctypes-python/test/wc.py (revision 1072854) +++ subversion/bindings/ctypes-python/test/wc.py (working copy) @@ -56,6 +56,8 @@ """Test case for Subversion WC layer.""" def setUp(self): + self.repos = None + self.wc = None dumpfile = open(os.path.join(os.path.split(__file__)[0], 'test.dumpfile')) @@ -63,7 +65,7 @@ self.tearDown() self.repos = LocalRepository(repos_location, create=True) self.repos.load(dumpfile) - + self.wc = WC(wc_location) self.wc.checkout(repo_url) @@ -73,6 +75,10 @@ svn_io_remove_dir(wc_location, pool) if os.path.exists(repos_location): svn_repos_delete(repos_location, pool) + if self.repos: + self.repos.clear_pool() + if self.wc: + self.wc.clear_pool() self.wc = None def _info_receiver(self, path, info): Index: subversion/bindings/ctypes-python/test/localrepos.py =================================================================== --- subversion/bindings/ctypes-python/test/localrepos.py (revision 1072854) +++ subversion/bindings/ctypes-python/test/localrepos.py (working copy) @@ -30,6 +30,7 @@ class LocalRepositoryTestCase(unittest.TestCase): def setUp(self): + self.repos = None dumpfile = open(os.path.join(os.path.split(__file__)[0], 'test.dumpfile')) @@ -41,6 +42,8 @@ def tearDown(self): if os.path.exists(repos_location): svn_repos_delete(repos_location, Pool()) + if self.repos: + self.repos.clear_pool() self.repos = None def test_local_latest_revnum(self): Index: subversion/bindings/ctypes-python/test/remoterepos.py =================================================================== --- subversion/bindings/ctypes-python/test/remoterepos.py (revision 1072854) +++ subversion/bindings/ctypes-python/test/remoterepos.py (working copy) @@ -43,43 +43,51 @@ class RemoteRepositoryTestCase(unittest.TestCase): def setUp(self): + self.local_repo = None + self.remote_repo = None + dumpfile = open(os.path.join(os.path.split(__file__)[0], - 'test.dumpfile')) + 'test.dumpfile')) # Just in case a preivous test instance was not properly cleaned up self.tearDown() - self.repos = LocalRepository(repos_location, create=True) - self.repos.load(dumpfile) + self.local_repo = LocalRepository(repos_location, create=True) + self.local_repo.load(dumpfile) - self.repos = RemoteRepository(repos_url) + self.remote_repo = RemoteRepository(repos_url) def tearDown(self): if os.path.exists(repos_location): svn_repos_delete(repos_location, Pool()) - self.repos = None + if self.remote_repo: + self.remote_repo.clear_pool() + if self.local_repo: + self.local_repo.clear_pool() + self.remote_repo = None + self.local_repo = None def test_remote_latest_revnum(self): - self.assertEqual(9, self.repos.latest_revnum()) + self.assertEqual(9, self.remote_repo.latest_revnum()) def test_remote_check_path(self): self.assertEqual(svn_node_file, - self.repos.check_path("trunk/README.txt")) + self.remote_repo.check_path("trunk/README.txt")) self.assertEqual(svn_node_dir, - self.repos.check_path("trunk/dir", 6)) + self.remote_repo.check_path("trunk/dir", 6)) self.assertEqual(svn_node_none, - self.repos.check_path("trunk/dir", 7)) + self.remote_repo.check_path("trunk/dir", 7)) self.assertEqual(svn_node_none, - self.repos.check_path("does_not_compute")) + self.remote_repo.check_path("does_not_compute")) def test_revprop_list(self): # Test argument-free case - props = self.repos.revprop_list() + props = self.remote_repo.revprop_list() self.assertEqual(props["svn:log"], "Restore information deleted in rev 8\n") self.assertEqual(props["svn:author"], "bruce") self.assertEqual(props["svn:date"], "2007-08-02T18:24:16.960652Z") # Test with revnum argument - props = self.repos.revprop_list(4) + props = self.remote_repo.revprop_list(4) self.assertEqual(props["svn:log"], "Add important new file. This marks the 1.0 release.\n\n") self.assertEqual(props["svn:author"], "clark") @@ -87,10 +95,10 @@ def test_revprop_get(self): # Test without revnum - self.assertEqual(self.repos.revprop_get("svn:log"), + self.assertEqual(self.remote_repo.revprop_get("svn:log"), "Restore information deleted in rev 8\n") # With revnum - self.assertEqual(self.repos.revprop_get("svn:date", 4), + self.assertEqual(self.remote_repo.revprop_get("svn:date", 4), "2007-08-02T17:38:08.361367Z") def test_revprop_set(self): @@ -114,14 +122,14 @@ ### with a fatal error, so we skip this test for now. return - revnum = self.repos.revprop_set("svn:log", "Changed log") + revnum = self.remote_repo.revprop_set("svn:log", "Changed log") self.assertEqual(revnum, 9) - self.assertEqual(self.repos.revprop_get("svn:log"), "Changed log") + self.assertEqual(self.remote_repo.revprop_get("svn:log"), "Changed log") # Test with revnum argument also - revnum = self.repos.revprop_set("svn:log", "Another changed log", 4) + revnum = self.remote_repo.revprop_set("svn:log", "Another changed log", 4) self.assertEqual(revnum, 4) - self.assertEqual(self.repos.revprop_get("svn:log", 4), + self.assertEqual(self.remote_repo.revprop_get("svn:log", 4), "Another changed log") @staticmethod @@ -133,7 +141,7 @@ f = open(newfile, "w") f.write("Some new stuff\n") f.close() - commit_info = self.repos.svnimport(newfile, "%s/newfile.txt" % repos_url, log_func=self._log_func) + commit_info = self.remote_repo.svnimport(newfile, "%s/newfile.txt" % repos_url, log_func=self._log_func) self.assertEqual(commit_info.revision, 10) def suite(): Index: subversion/bindings/ctypes-python/csvn/repos.py =================================================================== --- subversion/bindings/ctypes-python/csvn/repos.py (revision 1072854) +++ subversion/bindings/ctypes-python/csvn/repos.py (working copy) @@ -359,6 +359,11 @@ commit_info[0].pool = pool return commit_info[0] + def clear_pool(self): + "Clear pool" + if self.pool: + self.pool.clear() + class LocalRepository(object): """A client which accesses the repository directly. This class may allow you to perform some administrative actions which @@ -525,6 +530,11 @@ self.iterpool.clear() + def clear_pool(self): + "Clear pool" + if self.pool: + self.pool.clear() + class _fs(object): """NOTE: This is a private class. Don't use it outside of this module. Use the Repos class instead. Index: subversion/bindings/ctypes-python/csvn/wc.py =================================================================== --- subversion/bindings/ctypes-python/csvn/wc.py (revision 1072854) +++ subversion/bindings/ctypes-python/csvn/wc.py (working copy) @@ -804,3 +804,8 @@ merge_options.header, self.client, self.iterpool) self.iterpool.clear() + + def clear_pool(self): + "Clear pool" + if self.pool: + self.pool.clear()