clean up temporary conf file

This commit is contained in:
jleute 2018-05-19 02:42:45 +02:00
parent 500998b893
commit 3add623ac9
2 changed files with 13 additions and 4 deletions

View file

@ -5,7 +5,7 @@ from twisted.trial import unittest
from lbrynet import conf
from lbrynet.core.Error import InvalidCurrencyError
from lbrynet.tests import mocks
from lbrynet.tests.util import create_conf_file
from lbrynet.tests.util import create_conf_file, remove_conf_file
class SettingsTest(unittest.TestCase):
def setUp(self):
@ -93,6 +93,12 @@ class SettingsTest(unittest.TestCase):
settings.load_conf_file_settings()
first = settings.get('lbryum_servers', data_type=conf.TYPE_PERSISTED)
settings.save_conf_file_settings()
try:
settings.load_conf_file_settings()
except Exception, e:
remove_conf_file(conf_temp)
raise Exception(e)
second = settings.get('lbryum_servers', data_type=conf.TYPE_PERSISTED)
remove_conf_file(conf_temp)
self.assertEqual(first, second)

View file

@ -24,6 +24,9 @@ def create_conf_file(entry):
conf.write(entry)
return conf.name
def remove_conf_file(filename):
os.remove(filename)
def mk_db_and_blob_dir():
db_dir = tempfile.mkdtemp()
blob_dir = tempfile.mkdtemp()