I am working on automating a test that is dependent on some other tests. Lets say I have the tests setUp, testA, testB, testC. setUp() sets up the server or resources needed for other tests to start. testA, testB, testC need to wait until setUp is done and only then should start in parallel. My ultimate goal is to parallelize the tests. I was successful in sequential execution of the tests without any parallel execution so that way setUp -> testA -> testB -> testC is the order they are done but in reality testA, testB, testC can run in parallel so running them sequentially is wasting time. Here is the structure of my project: test_dummy.py class Values: can_continue = False ## This holds the boolean value which I am using for other functions to check if they can continue with their test class SetUp: def test_dummy_setUp(): ## All the code to setUp the environment ##Once above code is done then set the can_continue to true Values.can_continue = True class TestA: def test_methodA(): while Values.can_continue is False: sleep(10) ## When the can_continue is changed to True by setUp I want it to break out of loop and continue with execution ## Code to be executed class TestB: def test_methodB(): while Values.can_continue is False: sleep(10) ## When the can_continue is changed to True by setUp I want it to break out of loop and continue with execution ## Code to be executed When I run the test_dummy using pytest in parallel execution using 3 cores 3 browsers open up for each class (I am using Seleniumbase and using --distload) and as expected setUp proceeds with creating resources while the other two see that can_continue is initially False they go to sleep. And when the setUp is done creating resources, even though can_continue is set to True inside setUp, it looks like that update is not reflected to other two methods and they are in sleep forever. I can understand that this might be because a new Object is being created for each test class when it is started and the change is not reflected or this might not be the right way at all. I am new to Python and the scope is confusing me right now. My final goal is to have a variable that is accessible by all three classes SetUp, TestA, TestB and the changes made by any of the classes must also be visible to other classes instantly. What is the best way to achieve this in python? Thank you Continue reading...