1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
From: =?utf-8?q?Louis-Philippe_V=C3=A9ronneau?= <pollo@debian.org>
Date: Sun, 23 Oct 2022 13:40:52 -0400
Subject: Make sure the testsuite does not leave artifacts behind
Forwarded: https://github.com/libkeepass/pykeepass/pull/324
---
tests/tests.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -1,6 +1,7 @@
import logging
import os
import shutil
+import tempfile
import unittest
import uuid
from datetime import datetime, timedelta, timezone
@@ -920,8 +921,10 @@
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, '<?xml version=\'1.0\' encoding=\'utf-8\' standalone=\'yes\'?>\n')
|