mirror of
https://github.com/borgbase/vorta
synced 2024-12-23 08:17:08 +00:00
b015368fee
Move existing tests into subfolder `tests/unit`. Write integration tests that actually run the installed borg executable. Those tests can be found in `tests/integration`. Those pytest fixtures that are the same for both kinds of tests remain in `tests/conftest.py`. The others can be found in `tests/integration/conftest.py` or `tests/unit/conftest.py`. This adds nox to the project and configures it to run the tests with different borg versions. This also updates the ci workflow to run the integration tests using nox. * noxfile.py : Run pytest with a matrix of borg versions OR a specific borg version * Makefile : Run using nox. Add phonies `test-unit` and `test-integration`. * tests/conftest.py : Move some fixtures/functions to `tests/unit/conftest.py`. * tests/test_*.py --> tests/unit/ : Move unittests and assets into subfolder * tests/integration/ : Write integration tests. * requirements.d/dev.txt: Add `nox` and `pkgconfig`. The latter is needed for installing new borg versions. * .github/actions/setup/action.yml : Update to install pre-commit and nox when needed. The action now no longer installs Vorta. * .github/actions/install-dependencies/action.yml : Install system deps of borg with this new composite action. * .github/workflows/test.yml : Rename `test` ci to `test-unit` and update it for the new test setup. Implement `test-integration` ci. Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
22 lines
915 B
Python
22 lines
915 B
Python
import pytest
|
|
import vorta.views
|
|
|
|
|
|
def test_add_folder(qapp, qtbot, mocker, monkeypatch, choose_file_dialog):
|
|
monkeypatch.setattr(vorta.views.source_tab, "choose_file_dialog", choose_file_dialog)
|
|
main = qapp.main_window
|
|
main.tabWidget.setCurrentIndex(1)
|
|
tab = main.sourceTab
|
|
|
|
tab.source_add(want_folder=True)
|
|
qtbot.waitUntil(lambda: tab.sourceFilesWidget.rowCount() == 2, **pytest._wait_defaults)
|
|
|
|
# Test paste button with mocked clipboard
|
|
mock_clipboard = mocker.Mock()
|
|
mock_clipboard.text.return_value = __file__
|
|
mocker.patch.object(vorta.views.source_tab.QApplication, 'clipboard', return_value=mock_clipboard)
|
|
tab.paste_text()
|
|
qtbot.waitUntil(lambda: tab.sourceFilesWidget.rowCount() == 3, **pytest._wait_defaults)
|
|
|
|
# Wait for directory sizing to finish
|
|
qtbot.waitUntil(lambda: len(qapp.main_window.sourceTab.updateThreads) == 0, **pytest._wait_defaults)
|