From eaf590d941ddb5aa3538774ec428ed428ddebde0 Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 24 Jun 2021 02:26:45 +0300 Subject: [PATCH] vorta: enable tests and install the desktop file --- pkgs/applications/backup/vorta/default.nix | 69 ++++++++++++++++++---- 1 file changed, 58 insertions(+), 11 deletions(-) diff --git a/pkgs/applications/backup/vorta/default.nix b/pkgs/applications/backup/vorta/default.nix index 347a0de0503f..dc02e65bb7bc 100644 --- a/pkgs/applications/backup/vorta/default.nix +++ b/pkgs/applications/backup/vorta/default.nix @@ -1,11 +1,12 @@ { lib -, python3 +, python3Packages , fetchFromGitHub , wrapQtAppsHook , borgbackup +, qt5 }: -python3.pkgs.buildPythonApplication rec { +python3Packages.buildPythonApplication rec { pname = "vorta"; version = "0.7.7"; @@ -16,19 +17,34 @@ python3.pkgs.buildPythonApplication rec { sha256 = "sha256-AH9CvoWAaNLPLC+NL+VXtYq9CNCMt0AFtC1ZGXSlcHQ="; }; - postPatch = '' - sed -i -e '/setuptools_git/d' -e '/pytest-runner/d' setup.cfg - ''; - nativeBuildInputs = [ wrapQtAppsHook ]; - propagatedBuildInputs = with python3.pkgs; [ - paramiko peewee pyqt5 python-dateutil APScheduler psutil qdarkstyle - secretstorage appdirs setuptools + propagatedBuildInputs = with python3Packages; [ + paramiko + peewee + pyqt5 + python-dateutil + APScheduler + psutil + qdarkstyle + secretstorage + appdirs + setuptools ]; - # QT setup in tests broken. - doCheck = false; + postPatch = '' + substituteInPlace setup.cfg \ + --replace setuptools_git "" \ + --replace pytest-runner "" + + substituteInPlace src/vorta/assets/metadata/com.borgbase.Vorta.desktop \ + --replace Exec=vorta "Exec=$out/bin/vorta" \ + --replace com.borgbase.Vorta "com.borgbase.Vorta-symbolic" + ''; + + postInstall = '' + install -Dm644 src/vorta/assets/metadata/com.borgbase.Vorta.desktop $out/share/applications/com.borgbase.Vorta.desktop + ''; preFixup = '' makeWrapperArgs+=( @@ -37,6 +53,37 @@ python3.pkgs.buildPythonApplication rec { ) ''; + checkInputs = with python3Packages; [ + pytest-qt + pytest-mock + pytestCheckHook + ]; + + preCheck = '' + export HOME=$(mktemp -d) + # For tests/test_misc.py::test_autostart + mkdir -p $HOME/.config/autostart + export QT_PLUGIN_PATH="${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}" + export QT_QPA_PLATFORM=offscreen + ''; + + disabledTestPaths = [ + "tests/test_archives.py" + "tests/test_borg.py" + "tests/test_lock.py" + "tests/test_notifications.py" + ]; + + disabledTests = [ + "diff_archives_dict_issue-Users" + "diff_archives-test" + "test_repo_unlink" + "test_repo_add_success" + "test_ssh_dialog" + "test_create" + "test_scheduler_create_backup" + ]; + meta = with lib; { license = licenses.gpl3Only; homepage = "https://vorta.borgbase.com/";