I'm bootstrapping a new Selenium project using Python. Coming from the Java world, I used to wrap the Webdriver instance within a ThreadLocal. This way I'm sure when my tests are run in parallel with TestNG, my Webdriver sessions will be isolated and not shared between thread.
I want to implement the same behavior in Python. For the singleton, I can use a MetaClass. To run the test in paralel, I can use pytest-xdist. But can you tell me if both are compatible, meaning my session will not be mixed?