Skip to content

Commit

Permalink
make sure environment i not changed inside test_make_git_repo_safe
Browse files Browse the repository at this point in the history
  • Loading branch information
javierggt committed Jul 6, 2023
1 parent e957b86 commit d6703f8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ska_helpers/tests/test_git_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ def ska_ownership_ok():
return False


@pytest.mark.skipif(not CHANDRA_MODELS.exists(), reason="Chandra models dir is not there")
@pytest.mark.skipif(
not CHANDRA_MODELS.exists(), reason="Chandra models dir is not there"
)
@pytest.mark.skipif(ska_ownership_ok(), reason="Chandra models dir ownership is OK")
def test_make_git_repo_safe():
with tempfile.TemporaryDirectory() as tempdir, pytest.warns(
UserWarning, match="Updating git config"
def test_make_git_repo_safe(monkeypatch):
with (
tempfile.TemporaryDirectory() as tempdir,
pytest.warns(UserWarning, match="Updating git config"),
):
os.environ["HOME"] = tempdir
monkeypatch.setenv("HOME", tempdir)
repo = git.Repo(CHANDRA_MODELS)
with pytest.raises(git.exc.GitCommandError):
repo.is_dirty()
Expand Down

0 comments on commit d6703f8

Please sign in to comment.