Cancel Borg thread at end of test. (#648)

Maybe fixes #632
This commit is contained in:
Manu 2020-09-13 12:55:10 +08:00 committed by GitHub
parent 62a3c6e42b
commit a86683e2b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -52,6 +52,17 @@ def local_en():
os.environ['LANG'] = 'en'
@pytest.fixture(scope='function', autouse=True)
def cleanup(request, qapp, qtbot):
"""
Ensure BorgThread is stopped when new test starts.
"""
def ensure_borg_thread_stopped():
qapp.backup_cancelled_event.emit()
qtbot.waitUntil(lambda: not vorta.borg.borg_thread.BorgThread.is_running())
request.addfinalizer(ensure_borg_thread_stopped)
@pytest.fixture(scope='session')
def qapp(tmpdir_factory, local_en):
tmp_db = tmpdir_factory.mktemp('Vorta').join('settings.sqlite')