Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Tidy up noqa comments.

Andrey Rakhmatullinf4d8d6d8acf8
diff --git a/pyproject.toml b/pyproject.toml
index 4d20e5c1c..1378bab50 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -310,7 +310,6 @@ ignore = [
# Issues pending a review:
"docs/conf.py" = ["E402"]
"scrapy/utils/url.py" = ["F403", "F405"]
-"tests/CrawlerRunner/change_reactor.py" = ["E402"]
"tests/test_loader.py" = ["E741"]
[tool.ruff.lint.pydocstyle]
diff --git a/tests/CrawlerRunner/change_reactor.py b/tests/CrawlerRunner/change_reactor.py
index b20aa0c7c..de76e13e8 100644
--- a/tests/CrawlerRunner/change_reactor.py
+++ b/tests/CrawlerRunner/change_reactor.py
@@ -17,7 +17,7 @@ class NoRequestsSpider(Spider):
configure_logging({"LOG_FORMAT": "%(levelname)s: %(message)s", "LOG_LEVEL": "DEBUG"})
-from scrapy.utils.reactor import install_reactor
+from scrapy.utils.reactor import install_reactor # noqa: E402
install_reactor("twisted.internet.asyncioreactor.AsyncioSelectorReactor")
@@ -25,7 +25,7 @@ runner = CrawlerRunner()
d = runner.crawl(NoRequestsSpider)
-from twisted.internet import reactor
+from twisted.internet import reactor # noqa: E402
d.addBoth(callback=lambda _: reactor.stop())
reactor.run()
diff --git a/tests/test_feedexport.py b/tests/test_feedexport.py
index 790c347fb..c3d429c2b 100644
--- a/tests/test_feedexport.py
+++ b/tests/test_feedexport.py
@@ -473,7 +473,7 @@ class S3FeedStorageTest(unittest.TestCase):
class GCSFeedStorageTest(unittest.TestCase):
def test_parse_settings(self):
try:
- from google.cloud.storage import Client # noqa
+ from google.cloud.storage import Client # noqa: F401
except ImportError:
raise unittest.SkipTest("GCSFeedStorage requires google-cloud-storage")
@@ -487,7 +487,7 @@ class GCSFeedStorageTest(unittest.TestCase):
def test_parse_empty_acl(self):
try:
- from google.cloud.storage import Client # noqa
+ from google.cloud.storage import Client # noqa: F401
except ImportError:
raise unittest.SkipTest("GCSFeedStorage requires google-cloud-storage")
@@ -504,7 +504,7 @@ class GCSFeedStorageTest(unittest.TestCase):
@defer.inlineCallbacks
def test_store(self):
try:
- from google.cloud.storage import Client # noqa
+ from google.cloud.storage import Client # noqa: F401
except ImportError:
raise unittest.SkipTest("GCSFeedStorage requires google-cloud-storage")
diff --git a/tests/test_item.py b/tests/test_item.py
index daf5d4f59..13243b67f 100644
--- a/tests/test_item.py
+++ b/tests/test_item.py
@@ -273,9 +273,7 @@ class ItemMetaTest(unittest.TestCase):
def f(self):
# For rationale of this see:
# https://github.com/python/cpython/blob/ee1a81b77444c6715cbe610e951c655b6adab88b/Lib/test/test_super.py#L222
- return (
- __class__ # noqa https://github.com/scrapy/scrapy/issues/2836
- )
+ return __class__
MyItem()