mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-14 03:00:29 +03:00
remove redundant open() arg: encoding='utf8'
By default, open() returns a str: https://docs.python.org/3/library/functions.html#open By default, str is UTF-8: https://docs.python.org/3/library/stdtypes.html#str This used to matter on Python 2.x, but this code is 3.x only now.
This commit is contained in:
parent
6e5d1a6cc3
commit
57556aceee
9 changed files with 27 additions and 27 deletions
|
|
@ -427,7 +427,7 @@ class CommonTest(unittest.TestCase):
|
|||
def test_write_to_config(self):
|
||||
with tempfile.TemporaryDirectory() as tmpPath:
|
||||
cfgPath = os.path.join(tmpPath, 'config.py')
|
||||
with open(cfgPath, 'w', encoding='utf-8') as f:
|
||||
with open(cfgPath, 'w') as f:
|
||||
f.write(textwrap.dedent("""\
|
||||
# abc
|
||||
# test = 'example value'
|
||||
|
|
@ -445,7 +445,7 @@ class CommonTest(unittest.TestCase):
|
|||
fdroidserver.common.write_to_config(cfg, 'test', value='test value', config_file=cfgPath)
|
||||
fdroidserver.common.write_to_config(cfg, 'new_key', value='new', config_file=cfgPath)
|
||||
|
||||
with open(cfgPath, 'r', encoding='utf-8') as f:
|
||||
with open(cfgPath, 'r') as f:
|
||||
self.assertEqual(f.read(), textwrap.dedent("""\
|
||||
# abc
|
||||
test = 'test value'
|
||||
|
|
@ -465,7 +465,7 @@ class CommonTest(unittest.TestCase):
|
|||
with open(cfgPath, 'w') as f:
|
||||
pass
|
||||
fdroidserver.common.write_to_config({}, 'key', 'val', cfgPath)
|
||||
with open(cfgPath, 'r', encoding='utf-8') as f:
|
||||
with open(cfgPath, 'r') as f:
|
||||
self.assertEqual(f.read(), textwrap.dedent("""\
|
||||
|
||||
key = "val"
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ class MetadataTest(unittest.TestCase):
|
|||
fdroidserver.metadata.write_metadata(os.path.join(testdir, appid + '.yml'), app)
|
||||
|
||||
# assert rewrite result
|
||||
with open(os.path.join(testdir, 'fake.ota.update.yml'), 'r', encoding='utf-8') as result:
|
||||
with open('metadata-rewrite-yml/fake.ota.update.yml', 'r', encoding='utf-8') as orig:
|
||||
with open(os.path.join(testdir, 'fake.ota.update.yml'), 'r') as result:
|
||||
with open('metadata-rewrite-yml/fake.ota.update.yml', 'r') as orig:
|
||||
self.maxDiff = None
|
||||
self.assertEqual(result.read(), orig.read())
|
||||
|
||||
|
|
@ -97,8 +97,8 @@ class MetadataTest(unittest.TestCase):
|
|||
fdroidserver.metadata.write_metadata(os.path.join(testdir, appid + '.yml'), app)
|
||||
|
||||
# assert rewrite result
|
||||
with open(os.path.join(testdir, 'org.fdroid.fdroid.yml'), 'r', encoding='utf-8') as result:
|
||||
with open('metadata-rewrite-yml/org.fdroid.fdroid.yml', 'r', encoding='utf-8') as orig:
|
||||
with open(os.path.join(testdir, 'org.fdroid.fdroid.yml'), 'r') as result:
|
||||
with open('metadata-rewrite-yml/org.fdroid.fdroid.yml', 'r') as orig:
|
||||
self.maxDiff = None
|
||||
self.assertEqual(result.read(), orig.read())
|
||||
|
||||
|
|
@ -113,8 +113,8 @@ class MetadataTest(unittest.TestCase):
|
|||
fdroidserver.metadata.write_metadata(os.path.join(testdir, appid + '.yml'), app)
|
||||
|
||||
# assert rewrite result
|
||||
with open(os.path.join(testdir, 'app.with.special.build.params.yml'), 'r', encoding='utf-8') as result:
|
||||
with open('metadata-rewrite-yml/app.with.special.build.params.yml', 'r', encoding='utf-8') as orig:
|
||||
with open(os.path.join(testdir, 'app.with.special.build.params.yml'), 'r') as result:
|
||||
with open('metadata-rewrite-yml/app.with.special.build.params.yml', 'r') as orig:
|
||||
self.maxDiff = None
|
||||
self.assertEqual(result.read(), orig.read())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue