refactor: Changing the py test to use less globals and session only locally.