summaryrefslogtreecommitdiffstats
path: root/gitlint-core/gitlint/tests/test_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitlint-core/gitlint/tests/test_utils.py')
-rw-r--r--gitlint-core/gitlint/tests/test_utils.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/gitlint-core/gitlint/tests/test_utils.py b/gitlint-core/gitlint/tests/test_utils.py
index 4ec8bda..27036d3 100644
--- a/gitlint-core/gitlint/tests/test_utils.py
+++ b/gitlint-core/gitlint/tests/test_utils.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
from unittest.mock import patch
from gitlint import utils
@@ -7,13 +5,12 @@ from gitlint.tests.base import BaseTestCase
class UtilsTests(BaseTestCase):
-
def tearDown(self):
# Since we're messing around with `utils.PLATFORM_IS_WINDOWS` during these tests, we need to reset
# its value after we're done this doesn't influence other tests
utils.PLATFORM_IS_WINDOWS = utils.platform_is_windows()
- @patch('os.environ')
+ @patch("os.environ")
def test_use_sh_library(self, patched_env):
patched_env.get.return_value = "1"
self.assertEqual(utils.use_sh_library(), True)
@@ -25,15 +22,11 @@ class UtilsTests(BaseTestCase):
self.assertEqual(utils.use_sh_library(), False, invalid_val)
patched_env.get.assert_called_once_with("GITLINT_USE_SH_LIB", None)
- # Assert that when GITLINT_USE_SH_LIB is not set, we fallback to checking whether we're on Windows
- utils.PLATFORM_IS_WINDOWS = True
+ # Assert that when GITLINT_USE_SH_LIB is not set, we fallback to False (not using)
patched_env.get.return_value = None
self.assertEqual(utils.use_sh_library(), False)
- utils.PLATFORM_IS_WINDOWS = False
- self.assertEqual(utils.use_sh_library(), True)
-
- @patch('gitlint.utils.locale')
+ @patch("gitlint.utils.locale")
def test_default_encoding_non_windows(self, mocked_locale):
utils.PLATFORM_IS_WINDOWS = False
mocked_locale.getpreferredencoding.return_value = "foƶbar"
@@ -43,7 +36,7 @@ class UtilsTests(BaseTestCase):
mocked_locale.getpreferredencoding.return_value = False
self.assertEqual(utils.getpreferredencoding(), "UTF-8")
- @patch('os.environ')
+ @patch("os.environ")
def test_default_encoding_windows(self, patched_env):
utils.PLATFORM_IS_WINDOWS = True
# Mock out os.environ