Skip to content

Commit 1a22f84

Browse files
committed
Make sure the testsuite does not leave artifacts behind
1 parent 7fa6e97 commit 1a22f84

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/tests.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import logging
77
import os
88
import shutil
9+
import tempfile
910
import unittest
1011
import uuid
1112
from datetime import datetime, timedelta
@@ -831,8 +832,10 @@ def test_set_credentials(self):
831832
self.assertEqual('foobar_user', results.username)
832833

833834
def test_dump_xml(self):
834-
self.kp.dump_xml('db_dump.xml')
835-
with open('db_dump.xml') as f:
835+
self.test_dir = tempfile.mkdtemp()
836+
self.dump_file = os.path.join(self.test_dir, 'db_dump.xml')
837+
self.kp.dump_xml(self.dump_file)
838+
with open(self.dump_file) as f:
836839
first_line = f.readline()
837840
self.assertEqual(first_line, '<?xml version=\'1.0\' encoding=\'utf-8\' standalone=\'yes\'?>\n')
838841

0 commit comments

Comments
 (0)