/[thuban]/branches/WIP-pyshapelib-bramz/test/test_load.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/test/test_load.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1848 by bh, Tue Oct 21 11:06:56 2003 UTC revision 1931 by bh, Tue Nov 11 13:24:45 2003 UTC
# Line 242  class TestSingleLayer(LoadSessionTest): Line 242  class TestSingleLayer(LoadSessionTest):
242          self.session.Destroy()          self.session.Destroy()
243          self.session = None          self.session = None
244    
245        def test_leak(self):
246            """Test load_session for resource leaks
247    
248            The load_session function had a resource leak in that it created
249            cyclic references. The objects would have been eventually
250            collected by the garbage collector but too late. One symptom is
251            that when layers are removed so that the last normal reference
252            owned indirectly by the session to a shape store goes away, the
253            shape store is not actually removed from the session even though
254            the session only keeps weak references because there are still
255            references owned by the cyclic garbage.
256            """
257            session = load_session(self.filename())
258            self.session = session
259    
260            # sanity check
261            self.assertEquals(len(session.ShapeStores()), 1)
262    
263            # remove the map. The shapestore should go away too
264            session.RemoveMap(session.Maps()[0])
265            self.assertEquals(len(session.ShapeStores()), 0)
266    
267    
268  class TestLayerVisibility(LoadSessionTest):  class TestLayerVisibility(LoadSessionTest):
269    

Legend:
Removed from v.1848  
changed lines
  Added in v.1931

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26