Skip to content

Commit

Permalink
Making regression test put()'s transactional.
Browse files Browse the repository at this point in the history
This is to address flaky test failures.

See googleapis#535 for more discussion.
  • Loading branch information
dhermes committed Jan 22, 2015
1 parent 1bfa469 commit e407a68
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions regression/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def _get_post(self, id_or_name=None, post_content=None):

def _generic_test_post(self, name=None, key_id=None):
entity = self._get_post(id_or_name=(name or key_id))
datastore.put([entity])
with datastore.Transaction():
datastore.put([entity])

# Register entity to be deleted.
self.case_entities_to_delete.append(entity)
Expand Down Expand Up @@ -146,7 +147,8 @@ def test_save_key_self_reference(self):
entity['fullName'] = u'Full name'
entity['linkedTo'] = key # Self reference.

datastore.put([entity])
with datastore.Transaction():
datastore.put([entity])
self.case_entities_to_delete.append(entity)

query = datastore.Query(kind='Person')
Expand Down

0 comments on commit e407a68

Please sign in to comment.