Skip to content

Commit 9eb2499

Browse files
committed
Remove obsolete test files and configurations from the tests_old directory
- Deleted pytest.ini configuration file for old tests. - Removed gzipped base test data file. - Eliminated test files for custom allocation editor, property editor, tag editor, and export/import wizards. - Cleaned up associated test cases that are no longer relevant.
1 parent 0050155 commit 9eb2499

25 files changed

Lines changed: 34 additions & 2407 deletions

activity_browser/actions/database/database_export_bw2package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def run(cls, db_names: List[str] = None):
6565
title="Export to BW2Package",
6666
context=context
6767
)
68-
export_dialog.exec_()
68+
export_dialog.show()
6969

7070

7171
class ExportBW2PackageSetup(widgets.ABWizard):

activity_browser/actions/database/database_export_excel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def run(cls, db_names: List[str] = None):
6666
title="Export to Excel",
6767
context=context
6868
)
69-
export_dialog.exec_()
69+
export_dialog.show()
7070

7171

7272
class ExportExcelSetup(widgets.ABWizard):

tests/actions/test_database_actions.py

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,50 +39,60 @@ def test_database_duplicate(monkeypatch, qtbot, basic_database):
3939
assert dup_db in bd.databases
4040

4141

42-
def test_database_export_excel(monkeypatch, qtbot, basic_database):
42+
def test_database_export_excel(monkeypatch, qtbot, basic_database, tmp_path):
4343
"""Test exporting a database to Excel format."""
44+
from activity_browser.actions.database.database_export_excel import ExportExcelSetup
45+
4446
# Mock the file dialog to return a path
45-
test_path = "test_export.xlsx"
47+
test_path = str(tmp_path / "test_export.xlsx")
4648
monkeypatch.setattr(
4749
QtWidgets.QFileDialog,
4850
"getSaveFileName",
4951
staticmethod(lambda *args, **kwargs: (test_path, "")),
5052
)
5153

52-
# Mock the confirmation dialog
53-
monkeypatch.setattr(
54-
QtWidgets.QMessageBox,
55-
"question",
56-
staticmethod(lambda *args, **kwargs: QtWidgets.QMessageBox.Yes),
57-
)
58-
54+
# Call the action
5955
actions.DatabaseExportExcel.run([basic_database.name])
6056

61-
# The export happens in a thread, so we need to wait for it
62-
# For now, just check that no error was raised
57+
# Find the wizard dialog and wait for the export thread to finish
58+
wizard = application.main_window.findChild(ExportExcelSetup)
59+
assert wizard is not None
60+
61+
# Wait for the export thread to finish
62+
export_page = wizard.currentPage()
63+
with qtbot.waitSignal(export_page.thread.finished, timeout=10 * 1000):
64+
pass
65+
66+
# Close the wizard
67+
wizard.close()
6368

6469

65-
def test_database_export_bw2package(monkeypatch, qtbot, basic_database):
70+
def test_database_export_bw2package(monkeypatch, qtbot, basic_database, tmp_path):
6671
"""Test exporting a database to BW2Package format."""
72+
from activity_browser.actions.database.database_export_bw2package import ExportBW2PackageSetup
73+
6774
# Mock the file dialog to return a path
68-
test_path = "test_export.bw2package"
75+
test_path = str(tmp_path / "test_export.bw2package")
6976
monkeypatch.setattr(
7077
QtWidgets.QFileDialog,
7178
"getSaveFileName",
7279
staticmethod(lambda *args, **kwargs: (test_path, "")),
7380
)
7481

75-
# Mock the confirmation dialog
76-
monkeypatch.setattr(
77-
QtWidgets.QMessageBox,
78-
"question",
79-
staticmethod(lambda *args, **kwargs: QtWidgets.QMessageBox.Yes),
80-
)
81-
82+
# Call the action
8283
actions.DatabaseExportBW2Package.run([basic_database.name])
8384

84-
# The export happens in a thread, so we need to wait for it
85-
# For now, just check that no error was raised
85+
# Find the wizard dialog and wait for the export thread to finish
86+
wizard = application.main_window.findChild(ExportBW2PackageSetup)
87+
assert wizard is not None
88+
89+
# Wait for the export thread to finish
90+
export_page = wizard.currentPage()
91+
with qtbot.waitSignal(export_page.thread.finished, timeout=10 * 1000):
92+
pass
93+
94+
# Close the wizard
95+
wizard.close()
8696

8797

8898
def test_database_new(monkeypatch, basic_database):

tests_old/__init__.py

Whitespace-only changes.

tests_old/actions/test_activity_actions.py

Lines changed: 0 additions & 154 deletions
This file was deleted.

tests_old/actions/test_calculation_setup_actions.py

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)