diff --git a/qubesadmin/tests/tools/init.py b/qubesadmin/tests/tools/init.py index 1a0b45d9..ae099a88 100644 --- a/qubesadmin/tests/tools/init.py +++ b/qubesadmin/tests/tools/init.py @@ -32,8 +32,8 @@ def test_000_default(self): parser.set_defaults(properties={'defaultprop': 'defaultvalue'}) args = parser.parse_args([]) - self.assertDictContainsSubset( - {'defaultprop': 'defaultvalue'}, args.properties) + self.assertIn( + ('defaultprop', 'defaultvalue'), args.properties.items()) def test_001_set_prop(self): parser = argparse.ArgumentParser() @@ -41,8 +41,8 @@ def test_001_set_prop(self): action=qubesadmin.tools.PropertyAction) args = parser.parse_args(['-p', 'testprop=testvalue']) - self.assertDictContainsSubset( - {'testprop': 'testvalue'}, args.properties) + self.assertIn( + ('testprop', 'testvalue'), args.properties.items()) def test_002_set_prop_2(self): parser = argparse.ArgumentParser() @@ -52,8 +52,8 @@ def test_002_set_prop_2(self): args = parser.parse_args( ['-p', 'testprop=testvalue', '-p', 'testprop2=testvalue2']) - self.assertDictContainsSubset( - {'testprop': 'testvalue', 'testprop2': 'testvalue2'}, + self.assertEqual( + {'testprop': 'testvalue', 'testprop2': 'testvalue2'} | args.properties, args.properties) def test_003_set_prop_with_default(self): @@ -63,8 +63,8 @@ def test_003_set_prop_with_default(self): parser.set_defaults(properties={'defaultprop': 'defaultvalue'}) args = parser.parse_args(['-p', 'testprop=testvalue']) - self.assertDictContainsSubset( - {'testprop': 'testvalue', 'defaultprop': 'defaultvalue'}, + self.assertEqual( + {'testprop': 'testvalue', 'defaultprop': 'defaultvalue'} | args.properties, args.properties) def test_003_set_prop_override_default(self): @@ -75,9 +75,9 @@ def test_003_set_prop_override_default(self): parser.set_defaults(properties={'testprop': 'defaultvalue'}) args = parser.parse_args(['-p', 'testprop=testvalue']) - self.assertDictContainsSubset( - {'testprop': 'testvalue'}, - args.properties) + self.assertIn( + ('testprop', 'testvalue'), + args.properties.items()) class TC_01_SinglePropertyAction(qubesadmin.tests.QubesTestCase): @@ -101,24 +101,24 @@ def test_100_default(self): parser.set_defaults(properties={'testprop': 'defaultvalue'}) args = parser.parse_args([]) - self.assertDictContainsSubset( - {'testprop': 'defaultvalue'}, args.properties) + self.assertIn( + ('testprop', 'defaultvalue'), args.properties.items()) def test_101_set_prop(self): parser = argparse.ArgumentParser() parser.add_argument('--testprop', '-T', action=qubesadmin.tools.SinglePropertyAction) args = parser.parse_args(['-T', 'testvalue']) - self.assertDictContainsSubset( - {'testprop': 'testvalue'}, args.properties) + self.assertIn( + ('testprop', 'testvalue'), args.properties.items()) def test_102_set_prop_dest(self): parser = argparse.ArgumentParser() parser.add_argument('--testprop', '-T', dest='otherprop', action=qubesadmin.tools.SinglePropertyAction) args = parser.parse_args(['-T', 'testvalue']) - self.assertDictContainsSubset( - {'otherprop': 'testvalue'}, args.properties) + self.assertIn( + ('otherprop', 'testvalue'), args.properties.items()) def test_103_set_prop_const(self): parser = argparse.ArgumentParser() @@ -126,13 +126,13 @@ def test_103_set_prop_const(self): action=qubesadmin.tools.SinglePropertyAction, const='testvalue') args = parser.parse_args(['-T']) - self.assertDictContainsSubset( - {'testprop': 'testvalue'}, args.properties) + self.assertIn( + ('testprop', 'testvalue'), args.properties.items()) def test_104_set_prop_positional(self): parser = argparse.ArgumentParser() parser.add_argument('testprop', action=qubesadmin.tools.SinglePropertyAction) args = parser.parse_args(['testvalue']) - self.assertDictContainsSubset( - {'testprop': 'testvalue'}, args.properties) + self.assertIn( + ('testprop', 'testvalue'), args.properties.items()) diff --git a/qubesadmin/tests/tools/qvm_shutdown.py b/qubesadmin/tests/tools/qvm_shutdown.py index c5b3c5ed..16db432e 100644 --- a/qubesadmin/tests/tools/qvm_shutdown.py +++ b/qubesadmin/tests/tools/qvm_shutdown.py @@ -212,7 +212,7 @@ def test_015_wait_all_kill_timeout(self): self.app.expected_calls[ ('sys-net', 'admin.vm.CurrentState', None, None)] = \ b'0\x00power_state=Halted' - with self.assertRaisesRegexp(SystemExit, '2'): + with self.assertRaisesRegex(SystemExit, '2'): qubesadmin.tools.qvm_shutdown.main( ['--wait', '--all', '--timeout=1'], app=self.app) self.assertAllCalled()