Pabot - run suite in parallel but with 1 setup

as mentioned in the similar topic few weeks back - I didnt like the idea of injecting Pabot specific code (Run Setup Only Once) into my testsuites because that would mean, i would need to stub those out if someone else in the future would need to run the same test assets without Pabot and because my setup/teardown is not relevant suite basis but for for testrun and i didnt spot any mention of pabot supporting dunder init type of setup/teardown …

Also, my usecase is that for reporting purposes, i do not use robot’s own reporting features for actual test reporting but i need to construct a file suitable for 3rd party application …

So what i did was - i wrote my own test runner in python that runs runs setup / teardown as a separate testsuites with vanilla robot and pabot runs the actual tests in between … something like this;

import robot
from robot import rebot
from pabot.pabot import main_program as pabot
# my own "setup" code that reads cli args, path names etc  and builds up the necessary arguments for pabot and robot here 
robot.run(setup_suite,  ... rest of the arguments here ..)

pabot(pabot_arguments)
robot.run(teardown_suite,  ... rest of the arguments here ..)
rebot(setup_output, pabot_output, teardown_output, ... rest of the arguments here ...)

And what happens is that each testcase that is executed, drops its needed data (json, could have used pickle but json made things easier to debug) into output directory and then final call to teardown suite reads all the matching files off outputdir and generates the final report file that then gets stored into network share for the particular 3rd party app to read it from …