Skip to content

Commit 17f432a

Browse files
mrvisschermarc-vdm
andauthored
Fixed threading issue in Biosphere patcher (#1200)
* Fix threading issue in Biosphere patcher * Updated tests to wait for patching to complete * Update test for more explicit difference between installing and patching biosphere --------- Co-authored-by: marc-vdm <2yko3fodzd@posteo.net>
1 parent 6931bad commit 17f432a

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

activity_browser/ui/widgets/dialog.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ def __init__(self, version, parent=None):
524524
self.biosphere_thread.start()
525525

526526
# finally, check if patches are available for this version and apply them
527-
self.check_patches()
527+
#self.biosphere_thread.finished.connect(self.check_patches)
528528

529529
@Slot(int, str, name='updateThread')
530530
def update_progress(self, current: int, text: str) -> None:
@@ -534,6 +534,7 @@ def update_progress(self, current: int, text: str) -> None:
534534
def finished(self, result: int = None) -> None:
535535
self.biosphere_thread.exit(result or 0)
536536
self.setValue(3)
537+
self.check_patches()
537538
signals.change_project.emit(bw.projects.current)
538539
signals.project_selected.emit()
539540

tests/test_add_default_data.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ def test_add_default_data(qtbot, ab_app, monkeypatch):
3535
QtCore.Qt.LeftButton
3636
)
3737

38+
# The biosphere3 update finishes with a 'database_changed' signal.
39+
with qtbot.waitSignal(signals.database_changed, timeout=2 * 60 * 1000): # allow 2 mins for biosphere update
40+
pass
41+
3842
# biosphere was installed
3943
assert 'biosphere3' in bw.databases
4044

0 commit comments

Comments
 (0)