forked from openlp/openlp
Add retries around other db removals
This commit is contained in:
parent
1e8d787b93
commit
48eeb50d02
@ -87,8 +87,6 @@ class TestProjectorDB(TestCase):
|
|||||||
Set up anything necessary for all tests
|
Set up anything necessary for all tests
|
||||||
"""
|
"""
|
||||||
with patch('openlp.core.lib.projector.db.init_url') as mocked_init_url:
|
with patch('openlp.core.lib.projector.db.init_url') as mocked_init_url:
|
||||||
if os.path.exists(TEST_DB):
|
|
||||||
os.unlink(TEST_DB)
|
|
||||||
mocked_init_url.return_value = 'sqlite:///%s' % TEST_DB
|
mocked_init_url.return_value = 'sqlite:///%s' % TEST_DB
|
||||||
self.projector = ProjectorDB()
|
self.projector = ProjectorDB()
|
||||||
|
|
||||||
@ -98,6 +96,14 @@ class TestProjectorDB(TestCase):
|
|||||||
"""
|
"""
|
||||||
self.projector.session.close()
|
self.projector.session.close()
|
||||||
self.projector = None
|
self.projector = None
|
||||||
|
while retries < 5:
|
||||||
|
try:
|
||||||
|
if os.path.exists(TEST_DB):
|
||||||
|
os.unlink(TEST_DB)
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
time.sleep(1)
|
||||||
|
retries += 1
|
||||||
|
|
||||||
def find_record_by_ip_test(self):
|
def find_record_by_ip_test(self):
|
||||||
"""
|
"""
|
||||||
|
@ -60,13 +60,12 @@ class TestUtilsDBFunctions(TestCase):
|
|||||||
retries = 0
|
retries = 0
|
||||||
while retries < 5:
|
while retries < 5:
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(self.tmp_folder)
|
if os.path.exists(self.tmp_folder):
|
||||||
# os.unlink(self.db_tmp_path)
|
shutil.rmtree(self.tmp_folder)
|
||||||
break
|
break
|
||||||
except Exception as e:
|
except:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
retries += 1
|
retries += 1
|
||||||
print(e)
|
|
||||||
|
|
||||||
def delete_column_test(self):
|
def delete_column_test(self):
|
||||||
"""
|
"""
|
||||||
|
@ -65,8 +65,6 @@ class ProjectorSourceFormTest(TestCase, TestMixin):
|
|||||||
"""
|
"""
|
||||||
Set up anything necessary for all tests
|
Set up anything necessary for all tests
|
||||||
"""
|
"""
|
||||||
if os.path.exists(TEST_DB):
|
|
||||||
os.unlink(TEST_DB)
|
|
||||||
mocked_init_url.return_value = 'sqlite:///{}'.format(TEST_DB)
|
mocked_init_url.return_value = 'sqlite:///{}'.format(TEST_DB)
|
||||||
self.build_settings()
|
self.build_settings()
|
||||||
self.setup_application()
|
self.setup_application()
|
||||||
@ -90,6 +88,14 @@ class ProjectorSourceFormTest(TestCase, TestMixin):
|
|||||||
self.projectordb.session.close()
|
self.projectordb.session.close()
|
||||||
del(self.projectordb)
|
del(self.projectordb)
|
||||||
del(self.projector)
|
del(self.projector)
|
||||||
|
while retries < 5:
|
||||||
|
try:
|
||||||
|
if os.path.exists(TEST_DB):
|
||||||
|
os.unlink(TEST_DB)
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
time.sleep(1)
|
||||||
|
retries += 1
|
||||||
self.destroy_settings()
|
self.destroy_settings()
|
||||||
|
|
||||||
def source_dict_test(self):
|
def source_dict_test(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user