mirror of https://github.com/scrapy/scrapy.git
Merge 4ca92f4c49 into d8ba1571e7
This commit is contained in:
commit
db15d8f2c5
|
|
@ -348,9 +348,25 @@ markers = [
|
|||
"requires_internet: marks tests that need real Internet access",
|
||||
]
|
||||
filterwarnings = [
|
||||
"error",
|
||||
"ignore::DeprecationWarning:twisted.web.static",
|
||||
# Twisted doesn't close failed sockets after CannotListenError: https://github.com/twisted/twisted/issues/6108
|
||||
"ignore:Exception ignored in. <socket\\.socket.*laddr=..0\\.0\\.0\\.0., 0.:pytest.PytestUnraisableExceptionWarning",
|
||||
# Twisted leaves the listening socket open after a failed bind
|
||||
# (CannotListenError): https://github.com/twisted/twisted/issues/6108
|
||||
# The asyncio reactor likewise leaves client sockets and transports open on
|
||||
# teardown. These surface as unraisable exceptions during finalization; the
|
||||
# message wording varies across Python versions (sometimes there is no
|
||||
# "Exception ignored ..." prefix at all), so match on the object repr.
|
||||
"ignore:.*<socket\\.socket fd=:pytest.PytestUnraisableExceptionWarning",
|
||||
"ignore:.*calling deallocator <function (_SelectorTransport|_ProactorBasePipeTransport|_ProactorSocketTransport|BaseEventLoop)\\.__del__:pytest.PytestUnraisableExceptionWarning",
|
||||
# queuelib's test helpers (reused by tests/test_squeues.py) leave queue
|
||||
# files open; the resulting warning surfaces at an arbitrary GC point.
|
||||
"ignore:.*<_io\\.FileIO name=.*queuelib-tests-:pytest.PytestUnraisableExceptionWarning",
|
||||
# pyftpdlib imports the deprecated asyncore/asynchat modules on Python < 3.12.
|
||||
"ignore:The async(ore|hat) module is deprecated:DeprecationWarning",
|
||||
# Old w3lib (min env) compiles a regex with inline flags not at the start.
|
||||
"ignore:Flags not at the start of the expression:DeprecationWarning",
|
||||
# Old Twisted (min env) calls the deprecated threading.currentThread().
|
||||
"ignore:currentThread\\(\\) is deprecated:DeprecationWarning",
|
||||
]
|
||||
|
||||
[tool.ruff.lint]
|
||||
|
|
|
|||
|
|
@ -212,6 +212,10 @@ class TestInteractiveShell:
|
|||
p.expect_exact("Available Scrapy objects")
|
||||
p.sendeof()
|
||||
p.wait() # type: ignore[no-untyped-call]
|
||||
if p.proc.stdin:
|
||||
p.proc.stdin.close()
|
||||
if p.proc.stdout:
|
||||
p.proc.stdout.close()
|
||||
logfile.seek(0)
|
||||
return logfile.read().decode()
|
||||
|
||||
|
|
@ -238,6 +242,10 @@ class TestInteractiveShell:
|
|||
p.expect_exact("IPYMODULE False")
|
||||
p.sendeof()
|
||||
p.wait() # type: ignore[no-untyped-call]
|
||||
if p.proc.stdin:
|
||||
p.proc.stdin.close()
|
||||
if p.proc.stdout:
|
||||
p.proc.stdout.close()
|
||||
logfile.seek(0)
|
||||
assert "Traceback" not in logfile.read().decode()
|
||||
|
||||
|
|
|
|||
|
|
@ -207,16 +207,16 @@ class TestBlockingFeedStorage:
|
|||
def test_default_temp_dir(self):
|
||||
b = MyBlockingFeedStorage()
|
||||
|
||||
storage_file = b.open(self.get_test_spider())
|
||||
storage_dir = Path(storage_file.name).parent
|
||||
with b.open(self.get_test_spider()) as storage_file:
|
||||
storage_dir = Path(storage_file.name).parent
|
||||
assert str(storage_dir) == tempfile.gettempdir()
|
||||
|
||||
def test_temp_file(self, tmp_path):
|
||||
b = MyBlockingFeedStorage()
|
||||
|
||||
spider = self.get_test_spider({"FEED_TEMPDIR": str(tmp_path)})
|
||||
storage_file = b.open(spider)
|
||||
storage_dir = Path(storage_file.name).parent
|
||||
with b.open(spider) as storage_file:
|
||||
storage_dir = Path(storage_file.name).parent
|
||||
assert storage_dir == tmp_path
|
||||
|
||||
def test_invalid_folder(self, tmp_path):
|
||||
|
|
|
|||
Loading…
Reference in New Issue