I have some accounts as json file. It look like:
"accounts": [
{
"email": "email1",
"password": "qwerty",
"is_busy": false
},
{
"email": "email2",
"password": "qwerty",
"is_busy": false
},
{
"email": "email3",
"password": "qwerty",
"is_busy": false
}
]
}
I'm running my test with the -n
flag where after n
thread counts (the number of accounts in the json file) each account is needed to get a work resource. My code is trying to find an account for which is_busy
is set to false
and then set that value to true. So the second thread will also try to search, only for 2 accounts because 1 account is busy. When all threads are running, each account from the json will have the is_busy
flag set to true
. If one of the threads terminates, I want it to run tests from another thread.
Example:
class TestA:
def test_one_a(self):
time.sleep(200)
def test_second_a(self):
time.sleep(200)
class TestB:
def test_one_b(self):
time.sleep(10)
def test_second_b(self):
time.sleep(15)
Here, if TestA
is the first thread and TestB
is the second thread, then TestB
will complete faster than TestA
. And I want TestB to take the test named test_second_a
and run it on the first thread and TestB
won't run this test.
I want to implement the same for accounts