@@ -44,7 +44,31 @@ def gitconfig_default(monkeypatch: pytest.MonkeyPatch, user_path: pathlib.Path):
44
44
monkeypatch .setenv ("HOME" , str (user_path ))
45
45
46
46
47
- def test_repo_git_obtain_initial_commit_repo (tmp_path : pathlib .Path ):
47
+ @pytest .mark .parametrize (
48
+ # Postpone evaluation of options so fixture variables can interpolate
49
+ "constructor,lazy_constructor_options" ,
50
+ [
51
+ [
52
+ GitRepo ,
53
+ lambda bare_repo_dir , tmp_path , ** kwargs : {
54
+ "url" : f"file://{ bare_repo_dir } " ,
55
+ "repo_dir" : tmp_path / "obtaining a bare repo" ,
56
+ },
57
+ ],
58
+ [
59
+ create_repo_from_pip_url ,
60
+ lambda bare_repo_dir , tmp_path , ** kwargs : {
61
+ "pip_url" : f"git+file://{ bare_repo_dir } " ,
62
+ "repo_dir" : tmp_path / "obtaining a bare repo" ,
63
+ },
64
+ ],
65
+ ],
66
+ )
67
+ def test_repo_git_obtain_initial_commit_repo (
68
+ tmp_path : pathlib .Path ,
69
+ constructor ,
70
+ lazy_constructor_options ,
71
+ ):
48
72
"""initial commit repos return 'initial'.
49
73
50
74
note: this behaviors differently from git(1)'s use of the word "bare".
@@ -55,13 +79,7 @@ def test_repo_git_obtain_initial_commit_repo(tmp_path: pathlib.Path):
55
79
run (["git" , "init" , repo_name ], cwd = tmp_path )
56
80
57
81
bare_repo_dir = tmp_path / repo_name
58
-
59
- git_repo = create_repo_from_pip_url (
60
- ** {
61
- "pip_url" : f"git+file://{ bare_repo_dir } " ,
62
- "repo_dir" : tmp_path / "obtaining a bare repo" ,
63
- }
64
- )
82
+ git_repo : GitRepo = constructor (** lazy_constructor_options (** locals ()))
65
83
66
84
git_repo .obtain ()
67
85
assert git_repo .get_revision () == "initial"
0 commit comments