pathlib.Path.__enter__() usage is deprecated and not required, a no-op

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2023-06-28 11:43:23 +01:00 committed by Megan Wilhite
parent f4eea34984
commit 34f13a7632
3 changed files with 6 additions and 5 deletions

View file

@ -2,3 +2,4 @@ Some more deprecated code fixes:
* Stop using the deprecated `locale.getdefaultlocale()` function
* Stop accessing deprecated attributes
* `pathlib.Path.__enter__()` usage is deprecated and not required, a no-op

View file

@ -85,13 +85,13 @@ def world():
return "world"
"""
test_moduledir = salt_master.state_tree.base.paths[0] / "_{}".format(module_type)
test_moduledir = salt_master.state_tree.base.write_path / "_{}".format(module_type)
test_moduledir.mkdir(parents=True, exist_ok=True)
module_tempfile = salt_master.state_tree.base.temp_file(
"_{}/{}.py".format(module_type, module_name), module_contents
)
with module_tempfile, test_moduledir:
with module_tempfile:
salt_cmd = "saltutil.sync_{}".format(module_sync_functions[module_type])
ret = salt_run_cli.run(salt_cmd)
assert ret.returncode == 0

View file

@ -1070,7 +1070,7 @@ def test_recurse(
"{}.sls".format(sls_name), sls_contents
)
with sls_tempfile, test_tempdir:
with sls_tempfile:
for _dir in "test1", "test2", "test3":
test_tempdir.joinpath(_dir).mkdir(parents=True, exist_ok=True)
@ -1117,7 +1117,7 @@ def test_recurse_keep_symlinks_in_fileserver_root(
"{}.sls".format(sls_name), sls_contents
)
with sls_tempfile, test_tempdir:
with sls_tempfile:
for _dir in "test1", "test2", "test3":
test_tempdir.joinpath(_dir).mkdir(parents=True, exist_ok=True)
@ -1169,7 +1169,7 @@ def test_recurse_keep_symlinks_outside_fileserver_root(
"{}.sls".format(sls_name), sls_contents
)
with sls_tempfile, test_tempdir:
with sls_tempfile:
for _dir in "test1", "test2", "test3":
test_tempdir.joinpath(_dir).mkdir(parents=True, exist_ok=True)