diff --git a/scrapy/utils/spider.py b/scrapy/utils/spider.py index f1904e8f0..42b43b7d0 100644 --- a/scrapy/utils/spider.py +++ b/scrapy/utils/spider.py @@ -61,14 +61,13 @@ def iter_spider_classes( :attr:`~scrapy.Spider.name` is also excluded. """ for obj in vars(module).values(): - if ( - inspect.isclass(obj) - and issubclass(obj, Spider) - and obj.__module__ == module.__name__ - and not obj._is_ignored() - and (not require_name or getattr(obj, "name", None)) - ): - yield obj + if not inspect.isclass(obj) or not issubclass(obj, Spider): + continue + if obj.__module__ != module.__name__ or obj._is_ignored(): + continue + if require_name and not getattr(obj, "name", None): + continue + yield obj @overload diff --git a/tox.ini b/tox.ini index edde83356..fa0bf0057 100644 --- a/tox.ini +++ b/tox.ini @@ -111,7 +111,9 @@ commands = pre-commit run {posargs:--all-files} [testenv:pylint] -basepython = python3 +# Version-dependent code and pylint suppressions require a fixed interpreter. +# Keep in sync with the pylint job in .github/workflows/checks.yml. +basepython = python3.14 deps = {[testenv:extra-deps]deps} pylint==4.0.6