Skip to content

Commit

Permalink
Fix monkeypatch setattr to use path from pathlib
Browse files Browse the repository at this point in the history
  • Loading branch information
shatakshiiii committed Jun 6, 2024
1 parent 88d3a1c commit 53a3f87
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/unit/actions/run/test_artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import logging
import os
import pathlib
import re

from copy import deepcopy
Expand Down Expand Up @@ -201,7 +202,7 @@ def test_artifact_path(
"""
caplog.set_level(logging.DEBUG)
monkeypatch.setenv("HOME", "/home/test_user")
monkeypatch.setattr(os, "makedirs", make_dirs)
monkeypatch.setattr(pathlib.Path, "mkdir", make_dirs)
monkeypatch.setattr(action, "_get_status", get_status)
mocked_write = mocker.patch(
"ansible_navigator.actions.run.serialize_write_file",
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/configuration_subsystem/test_invalid_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def makedirs(*args: Any, **kwargs: dict[str, Any]) -> None:
"""
raise OSError

monkeypatch.setattr("os.makedirs", makedirs)
monkeypatch.setattr("pathlib.Path.mkdir", makedirs)
monkeypatch.setattr("shutil.which", which)

response = generate_config()
Expand Down

0 comments on commit 53a3f87

Please sign in to comment.