Skip to content

Instantly share code, notes, and snippets.

@jgeewax
Created August 20, 2010 23:08
Show Gist options
  • Save jgeewax/541380 to your computer and use it in GitHub Desktop.
Save jgeewax/541380 to your computer and use it in GitHub Desktop.
from __future__ import with_statement
import unittest
from gaetestbed import DataStoreTestCase
from myproject.models import MyModel
class MyTestCase(unittest.TestCase, DataStoreTestCase):
def test_num_queries(self):
# Check that no more than 1 query is run in this block of code
with self.max_queries(10):
# Whatever you do in here can't take more than 10 queries
# Otherwise the test case will fail.
MyModel(name='Name').put()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment