diff options
author | Sam Thursfield <sam@afuera.me.uk> | 2014-12-29 17:46:46 +0000 |
---|---|---|
committer | Sam Thursfield <sam@afuera.me.uk> | 2014-12-29 17:50:51 +0000 |
commit | d0366ae3955b63ea86a8179986a066912d52da20 (patch) | |
tree | d7020f61fee3ce0bb85b7cf4872cbedca048f457 /tests/functional-tests/12-transactions.py | |
parent | be82e043cb3c9f519d89ce4e45d6a0135bb6b1e2 (diff) | |
download | tracker-sam/functional-tests-pep8.tar.gz |
functional-tests: Reformat code to correspond to consistent stylesam/functional-tests-pep8
The standard coding style for Python is PEP-8. I used the 'autopep8'
tool to reformat all the tests to conform to PEP-8 style.
There should be no functional changes.
PEP-8: https://www.python.org/dev/peps/pep-0008/
autopep8: https://pypi.python.org/pypi/autopep8
Diffstat (limited to 'tests/functional-tests/12-transactions.py')
-rwxr-xr-x | tests/functional-tests/12-transactions.py | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/tests/functional-tests/12-transactions.py b/tests/functional-tests/12-transactions.py index a3c19f41d..ab62c2d24 100755 --- a/tests/functional-tests/12-transactions.py +++ b/tests/functional-tests/12-transactions.py @@ -30,7 +30,9 @@ from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreT TEST_INSTANCE_PATTERN = "test://12-transactions-%d" + class TrackerTransactionsTest (CommonTrackerStoreTest): + """ In a loop: 1. Inserts a Batch of instances @@ -41,49 +43,49 @@ class TrackerTransactionsTest (CommonTrackerStoreTest): If the commit was real, all the inserted instances should be there. """ - def setUp (self): + def setUp(self): self.instance_counter = 0 - def tearDown (self): + def tearDown(self): print "Tear down (will take some time to remove all resources)" delete_sparql = "DELETE { ?u a rdfs:Resource } WHERE { ?u a nmo:Email} \n" - self.tracker.update (delete_sparql, - timeout=60000) + self.tracker.update(delete_sparql, + timeout=60000) self.instance_counter = 0 - def insert_and_commit (self, number): + def insert_and_commit(self, number): insert_sparql = "INSERT {\n" - for i in range (0, number): - insert_sparql += " <" + TEST_INSTANCE_PATTERN % (self.instance_counter) + ">" + for i in range(0, number): + insert_sparql += " <" + \ + TEST_INSTANCE_PATTERN % (self.instance_counter) + ">" insert_sparql += " a nmo:Email.\n " self.instance_counter += 1 insert_sparql += "}" - self.tracker.batch_update (insert_sparql) - #print "Waiting for commit (", number," instances)" + self.tracker.batch_update(insert_sparql) + # print "Waiting for commit (", number," instances)" #start = time.time () - self.tracker.batch_commit () + self.tracker.batch_commit() #end = time.time () - #print "BatchCommit returned (after %d s.)" % (end - start) - + # print "BatchCommit returned (after %d s.)" % (end - start) - def test_commit_and_abort (self): + def test_commit_and_abort(self): - for i in range (0, 20): + for i in range(0, 20): NUMBER_OF_INSTANCES = 1000 - self.insert_and_commit (NUMBER_OF_INSTANCES) + self.insert_and_commit(NUMBER_OF_INSTANCES) - self.system.tracker_store_stop_brutally () - self.system.tracker_store_start () + self.system.tracker_store_stop_brutally() + self.system.tracker_store_start() try: - results = self.tracker.count_instances ("nmo:Email") + results = self.tracker.count_instances("nmo:Email") except: print "Timeout, probably replaying journal or something (wait 20 sec.)" - time.sleep (20) - results = self.tracker.count_instances () + time.sleep(20) + results = self.tracker.count_instances() # Every iteration we are adding new instances in the store! - self.assertEquals (results, NUMBER_OF_INSTANCES * (i+1)) + self.assertEquals(results, NUMBER_OF_INSTANCES * (i + 1)) if __name__ == "__main__": - ut.main () + ut.main() |