Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.

Commit 2b7714a

Browse files
committed
Fix some test warnings.
1 parent e65f5f3 commit 2b7714a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

httpsig/tests/test_signature.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ class TestSign(unittest.TestCase):
1717

1818
def setUp(self):
1919
self.key_path = os.path.join(os.path.dirname(__file__), 'rsa_private.pem')
20-
self.key = open(self.key_path, 'rb').read()
20+
with open(self.key_path, 'rb') as f:
21+
self.key = f.read()
2122

2223
def test_default(self):
2324
hs = sign.HeaderSigner(key_id='Test', secret=self.key)

httpsig/tests/test_verify.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,12 @@ def setUp(self):
144144
class TestVerifyRSASHA1(TestVerifyHMACSHA1):
145145
def setUp(self):
146146
private_key_path = os.path.join(os.path.dirname(__file__), 'rsa_private.pem')
147-
private_key = open(private_key_path, 'rb').read()
147+
with open(private_key_path, 'rb') as f:
148+
private_key = f.read()
148149

149150
public_key_path = os.path.join(os.path.dirname(__file__), 'rsa_public.pem')
150-
public_key = open(public_key_path, 'rb').read()
151+
with open(public_key_path, 'rb') as f:
152+
public_key = f.read()
151153

152154
self.keyId = "Test"
153155
self.algorithm = "rsa-sha1"

0 commit comments

Comments
 (0)