From 799fec92c39b1ff0696c6ebb182c4bef66b86e56 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Wed, 4 Mar 2020 19:33:45 -0800 Subject: [PATCH] utf-8 for windows support --- tests/test_pip_show.py | 16 ++++++++-------- tests/test_systemctl.py | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/test_pip_show.py b/tests/test_pip_show.py index 318b3cbc..9e6af845 100644 --- a/tests/test_pip_show.py +++ b/tests/test_pip_show.py @@ -10,29 +10,29 @@ class MyTests(unittest.TestCase): def setUp(self): # input - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/pip-show.out'), 'r') as f: + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/pip-show.out'), 'r', encoding='utf-8') as f: self.centos_7_7_pip_show = f.read() - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/pip-show.out'), 'r') as f: + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/pip-show.out'), 'r', encoding='utf-8') as f: self.ubuntu_18_4_pip_show = f.read() - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/pip-show.out'), 'r') as f: + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/pip-show.out'), 'r', encoding='utf-8') as f: self.osx_10_11_6_pip_show = f.read() - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/pip-show.out'), 'r') as f: + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/pip-show.out'), 'r', encoding='utf-8') as f: self.osx_10_14_6_pip_show = f.read() # output - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/pip-show.json'), 'r') as f: + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/pip-show.json'), 'r', encoding='utf-8') as f: self.centos_7_7_pip_show_json = json.loads(f.read()) - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/pip-show.json'), 'r') as f: + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/pip-show.json'), 'r', encoding='utf-8') as f: self.ubuntu_18_4_pip_show_json = json.loads(f.read()) - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/pip-show.json'), 'r') as f: + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/pip-show.json'), 'r', encoding='utf-8') as f: self.osx_10_11_6_pip_show_json = json.loads(f.read()) - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/pip-show.json'), 'r') as f: + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/pip-show.json'), 'r', encoding='utf-8') as f: self.osx_10_14_6_pip_show_json = json.loads(f.read()) def test_pip_show_centos_7_7(self): diff --git a/tests/test_systemctl.py b/tests/test_systemctl.py index 97d10a0f..1da9bad8 100644 --- a/tests/test_systemctl.py +++ b/tests/test_systemctl.py @@ -10,17 +10,17 @@ class MyTests(unittest.TestCase): def setUp(self): # input - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/systemctl.out'), 'r') as f: + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/systemctl.out'), 'r', encoding='utf-8') as f: self.centos_7_7_systemctl = f.read() - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/systemctl.out'), 'r') as f: + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/systemctl.out'), 'r', encoding='utf-8') as f: self.ubuntu_18_4_systemctl = f.read() # output - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/systemctl.json'), 'r') as f: + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/systemctl.json'), 'r', encoding='utf-8') as f: self.centos_7_7_systemctl_json = json.loads(f.read()) - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/systemctl.json'), 'r') as f: + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/systemctl.json'), 'r', encoding='utf-8') as f: self.ubuntu_18_4_systemctl_json = json.loads(f.read()) def test_systemctl_centos_7_7(self):