Pytest rewrite needs to support debugging, this issue tracks that. It is a bit more complicated than passing in a script because it needs to be debugged as a module and the environment variables needs to be passed such as appending to the python path and including the port for communication in the request.