Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/pytest_benchmark/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

from functools import partial
import os

import pytest

Expand Down Expand Up @@ -68,7 +69,9 @@ def __init__(self, config):
self.skip = config.getoption('benchmark_skip')
self.disabled = config.getoption('benchmark_disable') and not config.getoption('benchmark_enable')

if config.getoption('dist', 'no') != 'no' and not self.skip and not self.disabled:
# Only the main process has the 'dist' field in the config.
xdist_active = config.getoption('dist', 'no') != 'no' or os.environ.get('PYTEST_XDIST_WORKER', None)
if xdist_active and not self.skip and not self.disabled:
self.logger.warning(
'Benchmarks are automatically disabled because xdist plugin is active.'
'Benchmarks cannot be performed reliably in a parallelized environment.',
Expand Down
Loading