diff --git a/qubesadmin/tests/tools/qubes_prefs.py b/qubesadmin/tests/tools/qubes_prefs.py index 853e5cba..8e501d1e 100644 --- a/qubesadmin/tests/tools/qubes_prefs.py +++ b/qubesadmin/tests/tools/qubes_prefs.py @@ -55,7 +55,7 @@ def test_002_set_property(self): def test_003_invalid_property(self): self.app.expected_calls[ ('dom0', 'admin.property.Get', 'no_such_property', None)] = \ - b'2\x00AttributeError\x00\x00no_such_property\x00' + b'2\x00QubesNoSuchPropertyError\x00\x00no_such_property\x00' with self.assertRaises(SystemExit): with qubesadmin.tests.tools.StderrBuffer() as stderr: qubesadmin.tools.qubes_prefs.main([ @@ -67,7 +67,7 @@ def test_003_invalid_property(self): def test_004_set_invalid_property(self): self.app.expected_calls[ ('dom0', 'admin.property.Set', 'no_such_property', b'value')]\ - = b'2\x00AttributeError\x00\x00no_such_property\x00' + = b'2\x00QubesNoSuchPropertyError\x00\x00no_such_property\x00' with self.assertRaises(SystemExit): with qubesadmin.tests.tools.StderrBuffer() as stderr: qubesadmin.tools.qubes_prefs.main([ diff --git a/qubesadmin/tests/tools/qvm_prefs.py b/qubesadmin/tests/tools/qvm_prefs.py index d0bb1720..3e852395 100644 --- a/qubesadmin/tests/tools/qvm_prefs.py +++ b/qubesadmin/tests/tools/qvm_prefs.py @@ -77,7 +77,7 @@ def test_003_invalid_property(self): b'0\x00dom0 class=AdminVM state=Running\n' self.app.expected_calls[ ('dom0', 'admin.vm.property.Get', 'no_such_property', None)] = \ - b'2\x00AttributeError\x00\x00no_such_property\x00' + b'2\x00QubesNoSuchPropertyError\x00\x00no_such_property\x00' with self.assertRaises(SystemExit): with qubesadmin.tests.tools.StderrBuffer() as stderr: qubesadmin.tools.qvm_prefs.main([ @@ -92,7 +92,7 @@ def test_004_set_invalid_property(self): b'0\x00dom0 class=AdminVM state=Running\n' self.app.expected_calls[ ('dom0', 'admin.vm.property.Set', 'no_such_property', b'value')] = \ - b'2\x00AttributeError\x00\x00no_such_property\x00' + b'2\x00QubesNoSuchPropertyError\x00\x00no_such_property\x00' with self.assertRaises(SystemExit): with qubesadmin.tests.tools.StderrBuffer() as stderr: qubesadmin.tools.qvm_prefs.main([ diff --git a/qubesadmin/tools/qvm_prefs.py b/qubesadmin/tools/qvm_prefs.py index d8ae4c9d..d9e3c40b 100644 --- a/qubesadmin/tools/qvm_prefs.py +++ b/qubesadmin/tools/qvm_prefs.py @@ -125,7 +125,7 @@ def process_actions(parser, args, target): args.value = '' try: setattr(target, args.property, args.value) - except AttributeError: + except qubesadmin.exc.QubesNoSuchPropertyError: parser.error('no such property: {!r}'.format(args.property)) except qubesadmin.exc.QubesException as e: parser.error_runtime(e) @@ -134,7 +134,7 @@ def process_actions(parser, args, target): if args.delete: try: delattr(target, args.property) - except AttributeError: + except qubesadmin.exc.QubesNoSuchPropertyError: parser.error('no such property: {!r}'.format(args.property)) except qubesadmin.exc.QubesException as e: parser.error_runtime(e) @@ -144,7 +144,7 @@ def process_actions(parser, args, target): value = getattr(target, args.property) if value is not None: print(str(value)) - except AttributeError: + except qubesadmin.exc.QubesNoSuchPropertyError: parser.error('no such property: {!r}'.format(args.property)) except qubesadmin.exc.QubesException as e: parser.error_runtime(e)