Skip to content

Commit

Permalink
Dependency ChangeSet should be relative to parent path
Browse files Browse the repository at this point in the history
  • Loading branch information
drdavella committed Oct 27, 2023
1 parent 6ee8779 commit 9c3259d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/codemodder/dependency_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ def write(self, dry_run: bool = False) -> Optional[ChangeSet]:
f.writelines([f"{line}\n" for line in self.new_requirements])

self.dependency_file_changed = True
return ChangeSet(str(self.dependency_file), diff, changes=changes)
return ChangeSet(
str(self.dependency_file.relative_to(self.parent_directory)),
diff,
changes=changes,
)

@property
def found_dependency_file(self) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dependency_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_add_dependency_preserve_comments(self, tmpdir, dry_run):
)

assert changeset is not None
assert changeset.path == str(dependency_file)
assert changeset.path == dependency_file.name
assert changeset.diff == (
"--- \n"
"+++ \n"
Expand Down

0 comments on commit 9c3259d

Please sign in to comment.