mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 11:55:04 +00:00
Address some pylint issues (#1155)
* Address cyclic-import. * Address redefined-builtin. * Address redefined-argument-from-local. * Address many redefined-outer-name. * Address pointless-string-statement. * No longer needed due to separate bugfix. * Address useless-return. * Address possibly-used-before-assignment. * Add TODOs. * Address super-init-not-called. * Address function-redefined. * Address unspecified-encoding. * Clean up more imports.
This commit is contained in:
@@ -37,7 +37,7 @@ def make_tree(dirs, files):
|
||||
os.makedirs(os.path.join(base, path))
|
||||
|
||||
for path in files:
|
||||
with open(os.path.join(base, path), "w") as f:
|
||||
with open(os.path.join(base, path), "wt", encoding="utf-8") as f:
|
||||
f.write("content")
|
||||
|
||||
return base
|
||||
@@ -440,7 +440,7 @@ class TarTest(unittest.TestCase):
|
||||
base = tempfile.mkdtemp()
|
||||
full_path = os.path.join(base, "foo")
|
||||
self.addCleanup(shutil.rmtree, base)
|
||||
with open(full_path, "w") as f:
|
||||
with open(full_path, "wt", encoding="utf-8") as f:
|
||||
f.write("content")
|
||||
os.chmod(full_path, 0o222)
|
||||
with pytest.raises(IOError) as ei:
|
||||
@@ -452,7 +452,7 @@ class TarTest(unittest.TestCase):
|
||||
def test_tar_with_file_symlinks(self):
|
||||
base = tempfile.mkdtemp()
|
||||
self.addCleanup(shutil.rmtree, base)
|
||||
with open(os.path.join(base, "foo"), "w") as f:
|
||||
with open(os.path.join(base, "foo"), "wt", encoding="utf-8") as f:
|
||||
f.write("content")
|
||||
os.makedirs(os.path.join(base, "bar"))
|
||||
os.symlink("../foo", os.path.join(base, "bar/foo"))
|
||||
@@ -500,7 +500,7 @@ class TarTest(unittest.TestCase):
|
||||
base = tempfile.mkdtemp()
|
||||
filename = os.path.join(base, "th.txt")
|
||||
self.addCleanup(shutil.rmtree, base)
|
||||
with open(filename, "w") as f:
|
||||
with open(filename, "wt", encoding="utf-8") as f:
|
||||
f.write("Invisible Full Moon")
|
||||
os.utime(filename, (12345, -3600.0))
|
||||
with tar(base) as archive:
|
||||
|
||||
@@ -96,7 +96,7 @@ class LoadConfigTest(unittest.TestCase):
|
||||
"HttpHeaders": {"Name": "Spike", "Surname": "Spiegel"},
|
||||
}
|
||||
|
||||
with open(dockercfg_path, "w") as f:
|
||||
with open(dockercfg_path, "wt", encoding="utf-8") as f:
|
||||
json.dump(config_data, f)
|
||||
|
||||
cfg = config.load_general_config(dockercfg_path)
|
||||
@@ -108,7 +108,7 @@ class LoadConfigTest(unittest.TestCase):
|
||||
self.addCleanup(shutil.rmtree, folder)
|
||||
dockercfg_path = os.path.join(folder, "config.json")
|
||||
config_data = {"detachKeys": "ctrl-q, ctrl-u, ctrl-i"}
|
||||
with open(dockercfg_path, "w") as f:
|
||||
with open(dockercfg_path, "wt", encoding="utf-8") as f:
|
||||
json.dump(config_data, f)
|
||||
|
||||
cfg = config.load_general_config(dockercfg_path)
|
||||
@@ -119,7 +119,7 @@ class LoadConfigTest(unittest.TestCase):
|
||||
self.addCleanup(shutil.rmtree, folder)
|
||||
dockercfg_path = os.path.join(folder, "config.json")
|
||||
config_data = {"detachKeys": "ctrl-q, ctrl-u, ctrl-i"}
|
||||
with open(dockercfg_path, "w") as f:
|
||||
with open(dockercfg_path, "wt", encoding="utf-8") as f:
|
||||
json.dump(config_data, f)
|
||||
|
||||
with mock.patch.dict(os.environ, {"DOCKER_CONFIG": folder}):
|
||||
|
||||
Reference in New Issue
Block a user