I don't really get why you're changing these context items here. There's no need to do so, as provy/core/runner.py already does that when it's run from the command line.

If you need to change the context for tests, then change it for tests only, by providing an appropriate context to the role instance in the tests, instead of letting it leak to the production code.