Skip to content

Commit e2f7517

Browse files
baldurmenEvidlo
authored andcommitted
Make sure the testsuite does not leave artifacts behind
1 parent a2da685 commit e2f7517

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tests/tests.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import logging
44
import os
55
import shutil
6+
import tempfile
67
import unittest
78
import uuid
89
from datetime import datetime, timedelta, timezone
@@ -890,8 +891,10 @@ def test_set_credentials(self):
890891
self.assertEqual('foobar_user', results.username)
891892

892893
def test_dump_xml(self):
893-
self.kp.dump_xml('db_dump.xml')
894-
with open('db_dump.xml') as f:
894+
self.test_dir = tempfile.mkdtemp()
895+
self.dump_file = os.path.join(self.test_dir, 'db_dump.xml')
896+
self.kp.dump_xml(self.dump_file)
897+
with open(self.dump_file) as f:
895898
first_line = f.readline()
896899
self.assertEqual(first_line, '<?xml version=\'1.0\' encoding=\'utf-8\' standalone=\'yes\'?>\n')
897900

0 commit comments

Comments
 (0)