diff --git a/qubesmanager/backup.py b/qubesmanager/backup.py
index 4a0879a..ccdd531 100644
--- a/qubesmanager/backup.py
+++ b/qubesmanager/backup.py
@@ -31,7 +31,7 @@ from qubes.storage.file import get_disk_usage
from PyQt4 import QtCore # pylint: disable=import-error
from PyQt4 import QtGui # pylint: disable=import-error
-from . import ui_backupdlg
+from . import ui_backupdlg # pylint: disable=no-name-in-module
from . import multiselectwidget
from . import backup_utils
@@ -119,9 +119,9 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
def load_settings(self):
try:
profile_data = backup_utils.load_backup_profile()
- except FileNotFoundError as ex: # pylint: disable=unused-variable
+ except FileNotFoundError:
return
- except exc.QubesException as qex: # pylint: disable=unused-variable
+ except exc.QubesException:
QtGui.QMessageBox.information(
None, self.tr("Error loading backup profile"),
self.tr("Unable to load saved backup profile."))
@@ -232,7 +232,7 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
self.tr("Selected directory do not exists or "
"not a directory (%s).") % backup_location)
return False
- if not len(self.passphrase_line_edit.text()):
+ if not self.passphrase_line_edit.text():
QtGui.QMessageBox.information(
None, self.tr("Wait!"),
self.tr("Enter passphrase for backup "
@@ -268,7 +268,7 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
except Exception as ex: # pylint: disable=broad-except
msg.append(str(ex))
- if len(msg) > 0:
+ if msg:
t_monitor.set_error_msg('\n'.join(msg))
t_monitor.set_finished()
@@ -358,7 +358,7 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
return self.select_vms_widget.selected_list.count() > 0
def has_selected_dir_and_pass(self):
- if not len(self.passphrase_line_edit.text()):
+ if not self.passphrase_line_edit.text():
return False
if self.passphrase_line_edit.text() != \
self.passphrase_line_edit_verify.text():
diff --git a/qubesmanager/backup_utils.py b/qubesmanager/backup_utils.py
index 6590b2f..7774f77 100644
--- a/qubesmanager/backup_utils.py
+++ b/qubesmanager/backup_utils.py
@@ -19,8 +19,8 @@
#
#
import re
-from PyQt4 import QtGui
-from PyQt4 import QtCore
+from PyQt4 import QtGui # pylint: disable=import-error
+from PyQt4 import QtCore # pylint: disable=import-error
import subprocess
from . import utils
@@ -65,8 +65,7 @@ def select_path_button_clicked(dialog, select_file=False):
vm,
"qubes.SelectFile" if select_file
else "qubes.SelectDirectory")
- except subprocess.CalledProcessError as ex:
- # pylint: disable=unused-variable
+ except subprocess.CalledProcessError:
QtGui.QMessageBox.warning(
None,
dialog.tr("Nothing selected!"),
@@ -75,7 +74,7 @@ def select_path_button_clicked(dialog, select_file=False):
if new_path:
dialog.dir_line_edit.setText(new_path)
- if new_path and len(backup_location) > 0:
+ if new_path and backup_location:
dialog.select_dir_page.emit(QtCore.SIGNAL("completeChanged()"))
diff --git a/qubesmanager/restore.py b/qubesmanager/restore.py
index 72418fe..8425946 100644
--- a/qubesmanager/restore.py
+++ b/qubesmanager/restore.py
@@ -22,8 +22,8 @@
import sys
import shutil
-from PyQt4 import QtCore
-from PyQt4 import QtGui
+from PyQt4 import QtCore # pylint: disable=import-error
+from PyQt4 import QtGui # pylint: disable=import-error
import threading
import time
import os
@@ -34,7 +34,7 @@ import signal
from qubes import backup
-from . import ui_restoredlg
+from . import ui_restoredlg # pylint: disable=no-name-in-module
from . import multiselectwidget
from . import backup_utils
from . import thread_monitor
@@ -180,8 +180,8 @@ class RestoreVMsWindow(ui_restoredlg.Ui_Restore, QtGui.QWizard):
self.emit(QtCore.SIGNAL("restore_progress(QString)"),
'{0}'
.format(self.tr("Restore aborted!")))
- elif len(err_msg) > 0 or self.error_detected.is_set():
- if len(err_msg) > 0:
+ elif err_msg or self.error_detected.is_set():
+ if err_msg:
t_monitor.set_error_msg('\n'.join(err_msg))
self.emit(QtCore.SIGNAL("restore_progress(QString)"),
'{0}'
diff --git a/test-packages/qubes/backup/__init__.py b/test-packages/qubes/backup/__init__.py
new file mode 100644
index 0000000..dc24fbb
--- /dev/null
+++ b/test-packages/qubes/backup/__init__.py
@@ -0,0 +1,5 @@
+class BackupCanceledError(BaseException):
+
+ tmpdir = None
+
+ pass
diff --git a/test-packages/qubes/storage/file.py b/test-packages/qubes/storage/file.py
index 3171fd1..1503cca 100644
--- a/test-packages/qubes/storage/file.py
+++ b/test-packages/qubes/storage/file.py
@@ -1,2 +1,2 @@
def get_disk_usage(*args):
- return None
+ return 0
diff --git a/test-packages/qubesadmin/backup/__init__.py b/test-packages/qubesadmin/backup/__init__.py
new file mode 100644
index 0000000..fc80254
--- /dev/null
+++ b/test-packages/qubesadmin/backup/__init__.py
@@ -0,0 +1 @@
+pass
\ No newline at end of file
diff --git a/test-packages/qubesadmin/backup/restore/__init__.py b/test-packages/qubesadmin/backup/restore/__init__.py
new file mode 100644
index 0000000..aa328db
--- /dev/null
+++ b/test-packages/qubesadmin/backup/restore/__init__.py
@@ -0,0 +1,19 @@
+class BackupRestore(object):
+
+ options = object()
+ canceled = None
+
+ def get_restore_info(self, *args):
+ pass
+
+ def restore_do(self, *args):
+ pass
+
+ def get_restore_info(self, *args):
+ pass
+
+ def restore_info_verify(self, *args):
+ pass
+
+ def get_restore_summary(self, *args):
+ pass
diff --git a/test-packages/qubesadmin/events.py b/test-packages/qubesadmin/events.py
new file mode 100644
index 0000000..68c1b58
--- /dev/null
+++ b/test-packages/qubesadmin/events.py
@@ -0,0 +1,5 @@
+class EventsDispatcher(object):
+
+ def add_handler(self, *args):
+ pass
+ pass
diff --git a/test-packages/qubesadmin/exc.py b/test-packages/qubesadmin/exc.py
index 087af2a..a3635d7 100644
--- a/test-packages/qubesadmin/exc.py
+++ b/test-packages/qubesadmin/exc.py
@@ -1,4 +1,4 @@
-### mock qubesadmin.exc module
+# pylint: disable=unused-variable### mock qubesadmin.exc module
class QubesException(BaseException):
pass
diff --git a/test-packages/qubesadmin/utils.py b/test-packages/qubesadmin/utils.py
index afb7725..6915104 100644
--- a/test-packages/qubesadmin/utils.py
+++ b/test-packages/qubesadmin/utils.py
@@ -5,3 +5,6 @@ def parse_size(*args, **kwargs):
def updates_vms_status(*args, **kwargs):
return args[0]
+
+def size_to_human(*args, **kwargs):
+ return args[0]