From da8a6d5aff02bfa2e967c829d52ef8f9edb81664 Mon Sep 17 00:00:00 2001 From: Alexander Artemenko Date: Tue, 23 Feb 2021 17:50:07 +0300 Subject: [PATCH 1/2] Now pytest-parallel adds a pid to the test name. This is useful for debugging the way how tests are queued. --- pytest_parallel/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pytest_parallel/__init__.py b/pytest_parallel/__init__.py index 5702a64..c6741d7 100644 --- a/pytest_parallel/__init__.py +++ b/pytest_parallel/__init__.py @@ -331,6 +331,10 @@ def pytest_runtest_logreport(self, report): # We want workers to report to it's master. # Without this "if", master will try to report to itself. if self._config.parallel_worker: + if report.location is not None: + report.location = report.location[:2] + (f'{report.location[2]} (pid: {os.getpid()})',) + + report.nodeid = f'{report.nodeid} (pid: {os.getpid()})' data = self._config.hook.pytest_report_to_serializable( config=self._config, report=report ) From 2a2ef69efd74507aaa827ebb4918e9b065fef3f2 Mon Sep 17 00:00:00 2001 From: Alexander Artemenko Date: Mon, 20 Sep 2021 17:22:27 +0300 Subject: [PATCH 2/2] Made line shorter. --- pytest_parallel/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pytest_parallel/__init__.py b/pytest_parallel/__init__.py index c6741d7..a3071bf 100644 --- a/pytest_parallel/__init__.py +++ b/pytest_parallel/__init__.py @@ -332,7 +332,8 @@ def pytest_runtest_logreport(self, report): # Without this "if", master will try to report to itself. if self._config.parallel_worker: if report.location is not None: - report.location = report.location[:2] + (f'{report.location[2]} (pid: {os.getpid()})',) + location_with_pid = f'{report.location[2]} (pid: {os.getpid()})' + report.location = report.location[:2] + (location_with_pid,) report.nodeid = f'{report.nodeid} (pid: {os.getpid()})' data = self._config.hook.pytest_report_to_serializable(