From e2f75172d4d8a5820bd9ba9300cf23d3b7cf7023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis-Philippe=20V=C3=A9ronneau?= Date: Sun, 23 Oct 2022 13:40:52 -0400 Subject: [PATCH] Make sure the testsuite does not leave artifacts behind --- tests/tests.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/tests.py b/tests/tests.py index 9f7e4daa..b44d266f 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -3,6 +3,7 @@ import logging import os import shutil +import tempfile import unittest import uuid from datetime import datetime, timedelta, timezone @@ -890,8 +891,10 @@ def test_set_credentials(self): self.assertEqual('foobar_user', results.username) def test_dump_xml(self): - self.kp.dump_xml('db_dump.xml') - with open('db_dump.xml') as f: + self.test_dir = tempfile.mkdtemp() + self.dump_file = os.path.join(self.test_dir, 'db_dump.xml') + self.kp.dump_xml(self.dump_file) + with open(self.dump_file) as f: first_line = f.readline() self.assertEqual(first_line, '\n')