mirror of
https://github.com/novoid/filetags.git
synced 2026-06-14 03:21:19 +00:00
style(__init__.py, unit_tests.py): explicitly use utf-8
When running the unit tests with GitHub's Windows runner image, one test currently fails for lack of (sufficient) support for unicode characters. To address this issue, the file context managers are amended by an explicit `encoding="utf-8"`. Signed-off-by: Norwid Behrnd <nbehrnd@yahoo.com>
This commit is contained in:
parent
7cd8237910
commit
b5021b0a8f
2 changed files with 8 additions and 8 deletions
|
|
@ -2520,7 +2520,7 @@ def assert_empty_tagfilter_directory(directory):
|
|||
logging.debug('re-creating tagfilter directory "%s" ...' % str(directory))
|
||||
os.makedirs(directory)
|
||||
|
||||
with open(id, 'w'):
|
||||
with open(id, 'w', encoding="utf-8"):
|
||||
pass
|
||||
|
||||
if not options.dryrun:
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ class TestLocateAndParseControlledVocabulary(unittest.TestCase):
|
|||
def create_file(self, name, content):
|
||||
|
||||
assert(os.path.isdir(os.path.dirname(name)))
|
||||
with open(name, 'w') as outputhandle:
|
||||
with open(name, 'w', encoding="utf-8") as outputhandle:
|
||||
outputhandle.write(content)
|
||||
|
||||
def test_find_cv_in_startfile_dir_instead_of_cwd(self):
|
||||
|
|
@ -613,7 +613,7 @@ class TestFileWithoutTags(unittest.TestCase):
|
|||
|
||||
def create_tmp_file(self, name):
|
||||
|
||||
with open(os.path.join(self.tempdir, name), 'w') as outputhandle:
|
||||
with open(os.path.join(self.tempdir, name), 'w', encoding="utf-8") as outputhandle:
|
||||
outputhandle.write('This is a test file for filetags unit testing')
|
||||
|
||||
def file_exists(self, name):
|
||||
|
|
@ -825,7 +825,7 @@ class TestHierarchyWithFilesAndFolders(unittest.TestCase):
|
|||
|
||||
def create_tmp_file(self, directory, name):
|
||||
|
||||
with open(os.path.join(directory, name), 'w') as outputhandle:
|
||||
with open(os.path.join(directory, name), 'w', encoding="utf-8") as outputhandle:
|
||||
outputhandle.write('This is a test file for filetags unit testing')
|
||||
|
||||
def file_exists(self, name):
|
||||
|
|
@ -937,7 +937,7 @@ class TestHierarchyWithFilesAndFolders(unittest.TestCase):
|
|||
|
||||
def test_tagtrees_overwrites_old_default_directory(self):
|
||||
|
||||
with open(os.path.join(self.subdir2, 'boring tagtrees data.txt'), 'w'):
|
||||
with open(os.path.join(self.subdir2, 'boring tagtrees data.txt'), 'w', encoding="utf-8"):
|
||||
pass
|
||||
|
||||
filetags.generate_tagtrees(directory=self.subdir2,
|
||||
|
|
@ -952,7 +952,7 @@ class TestHierarchyWithFilesAndFolders(unittest.TestCase):
|
|||
|
||||
filetags.options.tagtrees_directory = self.subdir2
|
||||
|
||||
with open(os.path.join(self.subdir2, '.filetags_tagtrees'), 'w'):
|
||||
with open(os.path.join(self.subdir2, '.filetags_tagtrees'), 'w', encoding="utf-8"):
|
||||
pass
|
||||
|
||||
filetags.generate_tagtrees(directory=self.subdir2,
|
||||
|
|
@ -969,7 +969,7 @@ class TestHierarchyWithFilesAndFolders(unittest.TestCase):
|
|||
|
||||
filetags.options.tagtrees_directory = self.subdir2
|
||||
|
||||
with open(os.path.join(self.subdir2, 'critical data.txt'), 'w'):
|
||||
with open(os.path.join(self.subdir2, 'critical data.txt'), 'w', encoding="utf-8"):
|
||||
pass
|
||||
|
||||
with self.assertRaises(SystemExit):
|
||||
|
|
@ -1055,7 +1055,7 @@ class TestReplacingLinkSourceAndTarget(unittest.TestCase):
|
|||
|
||||
def create_source_file(self, name):
|
||||
|
||||
with open(os.path.join(self.sourcedir, name), 'w') as outputhandle:
|
||||
with open(os.path.join(self.sourcedir, name), 'w', encoding="utf-8") as outputhandle:
|
||||
outputhandle.write('This is a test file for filetags unit testing')
|
||||
|
||||
def create_link_file(self, source, destination):
|
||||
|
|
|
|||
Loading…
Reference in a new issue