Skip to content

Commit

Permalink
Add test_checkout_pygit2_with_home_env_unset unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
meaksh committed Jan 22, 2025
1 parent 6e5351c commit 1ee836a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/pytests/unit/utils/test_gitfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import salt.fileserver.gitfs
import salt.utils.gitfs
from salt.exceptions import FileserverConfigError
from tests.support.helpers import patched_environ
from tests.support.mock import MagicMock, patch

try:
Expand Down Expand Up @@ -239,6 +240,20 @@ def test_checkout_pygit2(_prepare_provider):
assert provider.checkout() is None


@pytest.mark.skipif(not HAS_PYGIT2, reason="This host lacks proper pygit2 support")
@pytest.mark.skip_on_windows(
reason="Skip Pygit2 on windows, due to pygit2 access error on windows"
)
def test_checkout_pygit2_with_home_env_unset(_prepare_provider):
provider = _prepare_provider
provider.remotecallbacks = None
provider.credentials = None
with patched_environ(__cleanup__=["HOME"]):
assert "HOME" not in os.environ
provider.init_remote()
assert "HOME" in os.environ


@pytest.mark.skipif(not HAS_PYGIT2, reason="This host lacks proper pygit2 support")
@pytest.mark.skip_on_windows(
reason="Skip Pygit2 on windows, due to pygit2 access error on windows"
Expand Down

0 comments on commit 1ee836a

Please sign in to comment.