def write_duration_row(self, item, phase, duration):
        """Helper to write a row to the tracked-test csv file."""
        if self.running_all:
            self.tests_csv.parent.mkdir(parents=True, exist_ok=True)
            with self.tests_csv.open("a", newline="", encoding="utf-8") as fcsv:
                csv.writer(fcsv).writerow([self.worker, item.nodeid, phase, duration])
Helper to write a row to the tracked-test csv file.
tests/balance_xdist_plugin.py