testing: Move _worker_id incrementer block to the top.

Incrementing the _worker_id should be the first step for the process.
It gives better structure to the code.
This commit is contained in:
Umair Khan
2017-04-21 11:31:21 +05:00
committed by Tim Abbott
parent 145fa0e5b2
commit 93b4200cae

View File

@@ -295,6 +295,15 @@ def init_worker(counter):
individual processes which are also called workers.
"""
global _worker_id
with counter.get_lock():
counter.value += 1
_worker_id = counter.value
"""
You can now use _worker_id.
"""
test_classes.API_KEYS = {}
# Clear the cache
@@ -305,10 +314,6 @@ def init_worker(counter):
# Close all connections
connections.close_all()
with counter.get_lock():
counter.value += 1
_worker_id = counter.value
destroy_test_databases(_worker_id)
create_test_databases(_worker_id)