]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-111347: Remove wrong assertion in test_sendfile (#111377)
authorzcxsythenew <30565051+zcxsythenew@users.noreply.github.com>
Sun, 29 Oct 2023 15:22:15 +0000 (23:22 +0800)
committerGitHub <noreply@github.com>
Sun, 29 Oct 2023 15:22:15 +0000 (08:22 -0700)
Windows is different.

Lib/test/test_asyncio/test_sendfile.py

index 0198da21d77028b22fd674858903f8cbe284fefb..d33ff197bbfa1de9988a3d1eb3d2dc205cf33295 100644 (file)
@@ -470,8 +470,11 @@ class SendfileMixin(SendfileBase):
 
         self.assertTrue(1024 <= srv_proto.nbytes < len(self.DATA),
                         srv_proto.nbytes)
-        self.assertTrue(1024 <= self.file.tell() < len(self.DATA),
-                        self.file.tell())
+        if not (sys.platform == 'win32'
+                and isinstance(self.loop, asyncio.ProactorEventLoop)):
+            # On Windows, Proactor uses transmitFile, which does not update tell()
+            self.assertTrue(1024 <= self.file.tell() < len(self.DATA),
+                            self.file.tell())
         self.assertTrue(cli_proto.transport.is_closing())
 
     def test_sendfile_fallback_close_peer_in_the_middle_of_receiving(self):