remove need for monkeypatching home

This commit is contained in:
Anthony Sottile 2021-12-20 23:09:53 -05:00
parent 829867bbda
commit 91ee010907
1 changed files with 9 additions and 13 deletions

View File

@ -85,10 +85,9 @@ xfailif_no_gitlfs = pytest.mark.xfail(
@xfailif_no_gitlfs
def test_allows_gitlfs(temp_git_dir, monkeypatch): # pragma: no cover
def test_allows_gitlfs(temp_git_dir): # pragma: no cover
with temp_git_dir.as_cwd():
monkeypatch.setenv('HOME', str(temp_git_dir))
cmd_output('git', 'lfs', 'install')
cmd_output('git', 'lfs', 'install', '--local')
temp_git_dir.join('f.py').write('a' * 10000)
cmd_output('git', 'lfs', 'track', 'f.py')
cmd_output('git', 'add', '--', '.')
@ -97,10 +96,9 @@ def test_allows_gitlfs(temp_git_dir, monkeypatch): # pragma: no cover
@xfailif_no_gitlfs
def test_moves_with_gitlfs(temp_git_dir, monkeypatch): # pragma: no cover
def test_moves_with_gitlfs(temp_git_dir): # pragma: no cover
with temp_git_dir.as_cwd():
monkeypatch.setenv('HOME', str(temp_git_dir))
cmd_output('git', 'lfs', 'install')
cmd_output('git', 'lfs', 'install', '--local')
cmd_output('git', 'lfs', 'track', 'a.bin', 'b.bin')
# First add the file we're going to move
temp_git_dir.join('a.bin').write('a' * 10000)
@ -112,10 +110,9 @@ def test_moves_with_gitlfs(temp_git_dir, monkeypatch): # pragma: no cover
@xfailif_no_gitlfs
def test_enforce_allows_gitlfs(temp_git_dir, monkeypatch): # pragma: no cover
def test_enforce_allows_gitlfs(temp_git_dir): # pragma: no cover
with temp_git_dir.as_cwd():
monkeypatch.setenv('HOME', str(temp_git_dir))
cmd_output('git', 'lfs', 'install')
cmd_output('git', 'lfs', 'install', '--local')
temp_git_dir.join('f.py').write('a' * 10000)
cmd_output('git', 'lfs', 'track', 'f.py')
cmd_output('git', 'add', '--', '.')
@ -123,11 +120,10 @@ def test_enforce_allows_gitlfs(temp_git_dir, monkeypatch): # pragma: no cover
assert main(('--enforce-all', '--maxkb', '9', 'f.py')) == 0
@xfailif_no_gitlfs # pragma: no cover
def test_enforce_allows_gitlfs_after_commit(temp_git_dir, monkeypatch):
@xfailif_no_gitlfs
def test_enforce_allows_gitlfs_after_commit(temp_git_dir): # pragma: no cover
with temp_git_dir.as_cwd():
monkeypatch.setenv('HOME', str(temp_git_dir))
cmd_output('git', 'lfs', 'install')
cmd_output('git', 'lfs', 'install', '--local')
temp_git_dir.join('f.py').write('a' * 10000)
cmd_output('git', 'lfs', 'track', 'f.py')
cmd_output('git', 'add', '--', '.')