From 1a22f849a7396116e4779defb4b30c022485d22e 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 e5624fca..77e3a57e 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -6,6 +6,7 @@ import logging import os import shutil +import tempfile import unittest import uuid from datetime import datetime, timedelta @@ -831,8 +832,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')