~lifeless/storm/bug-620615

« back to all changes in this revision

Viewing changes to tests/zope/zstorm.py

  • Committer: Gustavo Niemeyer
  • Date: 2008-06-18 23:13:04 UTC
  • mto: (235.2.21 need-for-speed-revenge)
  • mto: This revision was merged to the branch mainline in revision 245.
  • Revision ID: gustavo@niemeyer.net-20080618231304-iww2kewacv2ux78v
Simplify the calling semantics of _when in the expr module, as
suggested by James.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
# You should have received a copy of the GNU Lesser General Public License
19
19
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
20
#
21
 
import thread
 
21
import thread, weakref, gc
22
22
 
23
23
from tests.helper import TestHelper
24
24
 
212
212
        self.zstorm._reset()
213
213
        self.assertEquals(
214
214
            len(transaction.manager._synchs.values()[0].data.values()), 0)
 
215
 
 
216
    def test_store_strong_reference(self):
 
217
        """
 
218
        The zstorm utility should be a strong reference to named stores so that
 
219
        it doesn't recreate stores uselessly.
 
220
        """
 
221
        store = self.zstorm.get("name", "sqlite:")
 
222
        store_ref = weakref.ref(store)
 
223
        transaction.abort()
 
224
        del store
 
225
        gc.collect()
 
226
        self.assertNotIdentical(store_ref(), None)
 
227
        store = self.zstorm.get("name")
 
228
        self.assertIdentical(store_ref(), store)