def test_main_command_not_found(self, stderr): args = ["hello", "world"] with self.assertRaises(SystemExit) as cm: plugin.main(["wat"] + args) exc = cm.exception self.assertEqual(2, exc.code) stderr.write.assert_called_with(u'command "wat" not found\n')
def test_main(self): original_scale = plugin.scale def clean(): plugin.scale = original_scale self.addCleanup(clean) plugin.scale = mock.Mock() base_args = ["hello", "world"] plugin.main(["scale"] + base_args) plugin.scale.assert_called_with(base_args)