mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-02-19 11:54:58 -05:00
Merge pull request #3117 from joaommartins/bugfix/check-default-branch-name-in-tests
Fix test_git_diff to use dynamic branch name
This commit is contained in:
@@ -143,13 +143,15 @@ def test_git_diff_staged_empty(test_repository):
|
||||
assert result == ""
|
||||
|
||||
def test_git_diff(test_repository):
|
||||
# Get the default branch name (could be "main" or "master")
|
||||
default_branch = test_repository.active_branch.name
|
||||
test_repository.git.checkout("-b", "feature-diff")
|
||||
file_path = Path(test_repository.working_dir) / "test.txt"
|
||||
file_path.write_text("feature changes")
|
||||
test_repository.index.add(["test.txt"])
|
||||
test_repository.index.commit("feature commit")
|
||||
|
||||
result = git_diff(test_repository, "master")
|
||||
result = git_diff(test_repository, default_branch)
|
||||
|
||||
assert "test.txt" in result
|
||||
assert "feature changes" in result
|
||||
|
||||
Reference in New Issue
Block a user