From 0139a010e37969439920317b8fbc237adbb451da Mon Sep 17 00:00:00 2001 From: Dmitry Bogun Date: Thu, 29 Dec 2016 17:42:16 +0200 Subject: [PATCH] Fix code incompotable with python2.7 Change-Id: I10c3ccd7572b10e4f87232832743ff52ee5e6e3d --- bareon/drivers/deploy/mixins.py | 2 +- bareon/tests/test_deploy_mixins.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bareon/drivers/deploy/mixins.py b/bareon/drivers/deploy/mixins.py index 67602f4..68d7920 100644 --- a/bareon/drivers/deploy/mixins.py +++ b/bareon/drivers/deploy/mixins.py @@ -53,7 +53,7 @@ class MountableMixin(object): mtab_path = os.path.join(mount_dir, 'etc/mtab') if os.path.islink(mtab_path): os.remove(mtab_path) - with open(mtab_path, 'wt', encoding='utf-8') as f: + with open(mtab_path, 'wt') as f: f.write(six.text_type(mtab)) def _umount_target(self, mount_dir, os_id=None, pseudo=True): diff --git a/bareon/tests/test_deploy_mixins.py b/bareon/tests/test_deploy_mixins.py index 11cde00..1461fc5 100644 --- a/bareon/tests/test_deploy_mixins.py +++ b/bareon/tests/test_deploy_mixins.py @@ -43,8 +43,7 @@ class TestMountableMixin(unittest2.TestCase): mock_os.path.join.side_effect = lambda x, y: "%s/%s" % (x, y) mock_utils.execute.return_value = (None, None) self.mxn._mount_target('fake_chroot') - mock_open.assert_called_once_with('fake_chroot/etc/mtab', 'wt', - encoding='utf-8') + mock_open.assert_called_once_with('fake_chroot/etc/mtab', 'wt') mock_os.path.islink.assert_called_once_with('fake_chroot/etc/mtab') mock_os.remove.assert_called_once_with('fake_chroot/etc/mtab') @@ -99,8 +98,7 @@ none /run/shm tmpfs rw,nosuid,nodev 0 0""" mock_fu.mount_bind.call_args_list) file_handle = mock_open.return_value.__enter__.return_value file_handle.write.assert_called_once_with(fake_mtab) - mock_open.assert_called_once_with('fake_chroot/etc/mtab', 'wt', - encoding='utf-8') + mock_open.assert_called_once_with('fake_chroot/etc/mtab', 'wt') mock_os.path.islink.assert_called_once_with('fake_chroot/etc/mtab') self.assertFalse(mock_os.remove.called)