--Serguei
Hallo Robert,yes, the question is how to prevent one test from seeing data of another test. E.g. the following test can be executed on appengine but the test_user_put_2 will fail because it finds two user entries including one created in test_user_put_1:class UserModelTest(unittest.TestCase):def test_user_put_1(self):models.User(email="1...@example.com").put()users = models.User.query(models.User.email=="1...@example.com").fetch(2)self.assertEqual(1, len(users))def test_user_put_2(self):models.User(email="1...@example.com").put()users = models.User.query(models.User.email=="1...@example.com").fetch(2)self.assertEqual(1, len(users))Your answer really helps, adding these functions resolves the issue:def setUp(self):self.testbed = testbed.Testbed()self.testbed.activate()self.testbed.init_datastore_v3_stub()self.testbed.init_memcache_stub()def tearDown(self):self.testbed.deactivate()But the usage of testbed within aeta testrunner is still not quite clear to me.I thought with aete we can and should call *real* services and not using stubs. I also seen that using some other stubs e.g. mail_stub does not work within appengine/aeta.Serguei.
Am Dienstag, 27. November 2012 07:15:13 UTC+1 schrieb Robert Schuppenies:Hi Serguei.Could you explain your test setup and the problems you are having a bit more? I'm not quite sure I understand your question.What I can say for now though is that if you use testbed for testing datastore-related operations, and you are using Testbed.activate() and Testbed.deactivate() in your setUp() and tearDown() methods, your tests should be isolated and no test data from one test should be seen by another. In particular, deactivate() will restore the state that the stubs where in when you called activate().aeta does not touch stubs or any other App Engine related parts, it is merely a test runner that will locate tests and then run them.cheers,robertOn Mon, Nov 26, 2012 at 11:44 AM, Serguei <serguei...@gmail.com> wrote:Hallo,If using the testbed library to run tests locally, I initialize the stubs and get the same empty datastore and memcache for each test. Are there any recommendations on how to setUp/tearDown with aeta to avoid side effects caused by parallel or previous tests?The Java tool cloudcover seems to switch the namespace before executing test or track all datastore writes to remove test data later.Thanks.--Serguei
--
--