mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix pyobjects test on windows
This commit is contained in:
parent
e29485eddb
commit
e4b1ca3e30
1 changed files with 11 additions and 6 deletions
|
@ -9,22 +9,27 @@ def test_pyobjects_renderer(state, state_tree, tmp_path):
|
|||
"""
|
||||
Test pyobjects renderer when running state.sls
|
||||
"""
|
||||
file_path = str(tmp_path).replace("\\", "/")
|
||||
sls1_contents = f"""
|
||||
#!pyobjects
|
||||
import pathlib
|
||||
import salt://test_pyobjects2.sls
|
||||
test_file = pathlib.Path("{str(tmp_path)}", "test")
|
||||
File.managed(str(test_file), user='root', group='root', mode='1777')
|
||||
test_file = pathlib.Path("{file_path}", "test")
|
||||
File.managed(str(test_file))
|
||||
"""
|
||||
sls2_contents = f"""
|
||||
#!pyobjects
|
||||
import pathlib
|
||||
test_file = pathlib.Path("{str(tmp_path)}", "test2")
|
||||
File.managed(str(test_file), user='root', group='root', mode='1777')
|
||||
test_file = pathlib.Path("{file_path}", "test2")
|
||||
File.managed(str(test_file))
|
||||
"""
|
||||
|
||||
with pytest.helpers.temp_file("test_pyobjects.sls", sls1_contents, state_tree):
|
||||
with pytest.helpers.temp_file("test_pyobjects2.sls", sls2_contents, state_tree):
|
||||
with pytest.helpers.temp_file(
|
||||
"test_pyobjects.sls", sls1_contents, state_tree
|
||||
) as state1:
|
||||
with pytest.helpers.temp_file(
|
||||
"test_pyobjects2.sls", sls2_contents, state_tree
|
||||
) as state2:
|
||||
ret = state.sls("test_pyobjects")
|
||||
assert not ret.errors
|
||||
for state_return in ret:
|
||||
|
|
Loading…
Add table
Reference in a new issue