aiortc / aioquic

QUIC and HTTP/3 implementation in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do not leave stray file after test_packet.py is run

kitterma opened this issue · comments

Currently the test clutters the file system with 'bob.bin'. It would be better if it left things as the were before the test was run. See the patch below.

Scott K

diff --git a/tests/test_packet.py b/tests/test_packet.py
index 8621301..9c212b7 100644
--- a/tests/test_packet.py
+++ b/tests/test_packet.py
@@ -1,4 +1,5 @@
 import binascii
+import os
 from unittest import TestCase
 
 from aioquic.buffer import Buffer, BufferReadError
@@ -133,6 +134,7 @@ class PacketTest(TestCase):
         with open("bob.bin", "wb") as fp:
             fp.write(encoded)
         self.assertEqual(encoded, data)
+        os.remove("bob.bin")
 
     def test_pull_retry_draft_29(self):
         original_destination_cid = binascii.unhexlify("fbbd219b7363b64b")

Ouch, this was ugly, sorry about that. It looks like I left some debugging code when I updated the tests from draft-29 to the final RFC. There is just no need to write the file at all!