MCPcopy Create free account
hub / github.com/crewAIInc/crewAI / test_initialize_creates_initial_commit

Function test_initialize_creates_initial_commit

lib/cli/tests/test_git.py:118–148  ·  view source on GitHub ↗
(fp, tmp_path)

Source from the content-addressed store, hash-verified

116
117
118def test_initialize_creates_initial_commit(fp, tmp_path):
119 fp.register(["git", "--version"], stdout="git version 2.30.0\n")
120 fp.register(["git", "init"], stdout="")
121 fp.register(["git", "--version"], stdout="git version 2.30.0\n")
122 fp.register(["git", "rev-parse", "--is-inside-work-tree"], stdout="true\n")
123 fp.register(["git", "rev-parse", "--verify", "HEAD"], returncode=1)
124 fp.register(["git", "add", "."], stdout="")
125 fp.register(
126 [
127 "git",
128 "-c",
129 "user.name=CrewAI",
130 "-c",
131 "user.email=deploy@crewai.com",
132 "commit",
133 "--allow-empty",
134 "-m",
135 "Initial crew",
136 ],
137 stdout="",
138 )
139
140 repo = Repository.initialize(path=str(tmp_path))
141
142 assert repo.path == str(tmp_path)
143 exclude_file = tmp_path / ".git" / "info" / "exclude"
144 exclude_text = exclude_file.read_text()
145 assert ".env" in exclude_text
146 assert "!.env.example" in exclude_text
147 assert "!.env.sample" in exclude_text
148 assert "__pycache__/" in exclude_text
149
150
151def test_deployable_files_uses_git_excludes(fp, repository):

Callers

nothing calls this directly

Calls 3

read_textMethod · 0.80
registerMethod · 0.45
initializeMethod · 0.45

Tested by

no test coverage detected