From ac8b132605e86f6ad8c6ec4dd980ea587e3984a6 Mon Sep 17 00:00:00 2001 From: aliowka Date: Sun, 21 Jun 2026 20:17:03 +0300 Subject: [PATCH] Fix duplicate --reactor option registration in conftest.py --- conftest.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/conftest.py b/conftest.py index 90123f653..d37a556f9 100644 --- a/conftest.py +++ b/conftest.py @@ -59,6 +59,25 @@ except ImportError: def pytest_addoption(parser, pluginmanager): if pluginmanager.hasplugin("twisted"): return + + # Check if --reactor is already added by another plugin + has_reactor = False + for opt in getattr(parser, "_anonymous", None) or []: + if hasattr(opt, "names") and "--reactor" in opt.names(): + has_reactor = True + break + if not has_reactor: + for group in getattr(parser, "_groups", None) or []: + for opt in getattr(group, "options", []): + if hasattr(opt, "names") and "--reactor" in opt.names(): + has_reactor = True + break + if has_reactor: + break + + if has_reactor: + return + # add the full choice set so that pytest doesn't complain about invalid choices in some cases parser.addoption( "--reactor",