TL;DR: How do I get a pytest plugin to redirect the running tests to a spawned process (inside a different environment/python interpreter)?
I'm developing a python script that is run by a python interpreter embedded inside a third party application (Namely, IDA). I'm now in the process of creating tests for my script using pytest
, using a pytest
plugin I wrote for the application. Because the application makes certain modules available only within it's own interpreter any tests must be running in a python interpreter inside the application.
I would like to improve my pytest
plugin by allowing it to execute the pytest
session inside the third party application, instead inside a vanilla interpreter.
I know how to cause my tests and pytest
to run inside the application, which will be something similar to this:
subprocess.call("C:\Program Files\IDA\idaq.exe" -S <My script>", shell=True)
I'm struggling with where (a pytest
hook, I assume, but which one?) should I spawn the pytest
session inside? How can I make sure that test arguments are passed along to the new process?
I assume this is possible as a pytest plugin, because it somewhat resembles the xdist
plugin.