summaryrefslogtreecommitdiff
path: root/tests/test_41_response.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2017-10-06 08:02:05 -0400
committerJon Dufresne <jon.dufresne@gmail.com>2017-10-11 18:48:03 -0700
commitaea4d6a0dd052b3fa28e1b00c9922bf31326673c (patch)
treeea256e7191cd9b5acb287d737bd701e43982e3d5 /tests/test_41_response.py
parent847e970c5af6a09de61307be3a3d0305eee131f7 (diff)
downloadpysaml2-aea4d6a0dd052b3fa28e1b00c9922bf31326673c.tar.gz
Clean up unclosed files causing ResourceWarnings in tests
* Use better subprocess functions to correctly close pipes. * When opening files, use a context manager to ensure file is closed in a deterministic way. * Close logging handlers
Diffstat (limited to 'tests/test_41_response.py')
-rw-r--r--tests/test_41_response.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/test_41_response.py b/tests/test_41_response.py
index e017d1cf..c2b98ad7 100644
--- a/tests/test_41_response.py
+++ b/tests/test_41_response.py
@@ -94,7 +94,8 @@ class TestResponse:
assert isinstance(resp, AuthnResponse)
def test_false_sign(self):
- xml_response = open(FALSE_ASSERT_SIGNED).read()
+ with open(FALSE_ASSERT_SIGNED) as fp:
+ xml_response = fp.read()
resp = response_factory(
xml_response, self.conf,
return_addrs=["http://lingon.catalogix.se:8087/"],
@@ -113,7 +114,8 @@ class TestResponse:
assert False
def test_other_response(self):
- xml_response = open(full_path("attribute_response.xml")).read()
+ with open(full_path("attribute_response.xml")) as fp:
+ xml_response = fp.read()
resp = response_factory(
xml_response, self.conf,
return_addrs=['https://myreviewroom.com/saml2/acs/'],