From 8779acd6874f43643480a8fdb58d72398e9274be Mon Sep 17 00:00:00 2001 From: M Bussonnier Date: Thu, 21 Nov 2024 11:00:07 +0100 Subject: [PATCH] Don't assume config exists. Closes #270 --- pytest_doctestplus/plugin.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pytest_doctestplus/plugin.py b/pytest_doctestplus/plugin.py index 5538c53..5d8f6d9 100644 --- a/pytest_doctestplus/plugin.py +++ b/pytest_doctestplus/plugin.py @@ -208,8 +208,12 @@ def _is_numpy_ufunc(method): def pytest_configure(config): - doctest_plugin = config.pluginmanager.getplugin('doctest') - run_regular_doctest = config.option.doctestmodules and not config.option.doctest_plus + doctest_plugin = config.pluginmanager.getplugin("doctest") + if not hasattr(config.option, "doctestmodules"): + return + run_regular_doctest = ( + config.option.doctestmodules and not config.option.doctest_plus + ) if config.option.doctest_plus_generate_diff: config.option.doctest_only = True use_doctest_plus = config.getini(