Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for creating remote repositories during test setup by introducing a new include_remote_repo parameter to the create_repo_smith function. When enabled, a bare git repository is created and configured as the "origin" remote, allowing tests to simulate push workflows.
Changes:
- Added
include_remote_repoboolean option toCreateRepoOptionsTypedDict - Implemented logic to create a temporary bare git repository and configure it as the "origin" remote when
include_remote_repo=True - Added cleanup logic to remove the temporary bare repository after the context manager exits
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/repo_smith/repo_smith.py
Outdated
| if repo is not None: | ||
| repo.git.clear_cache() | ||
| shutil.rmtree(dir) | ||
|
|
There was a problem hiding this comment.
Trailing whitespace on this line should be removed to maintain code consistency and follow Python style guidelines.
src/repo_smith/repo_smith.py
Outdated
| if include_remote_repo: | ||
| local_remote_dir = tempfile.mkdtemp() | ||
| remote_path = os.path.join(local_remote_dir, "remote.git") | ||
| Repo.init(remote_path, bare=True) | ||
| repo.create_remote("origin", remote_path) |
There was a problem hiding this comment.
The new include_remote_repo functionality lacks test coverage. Since other parts of the codebase have comprehensive test coverage (as seen in the tests/integration directory), this new behavior should have corresponding tests to verify that the remote repository is correctly created and cleaned up.
src/repo_smith/repo_smith.py
Outdated
| repo = Repo.clone_from(clone_from, dir) | ||
| else: | ||
| repo = Repo.init(dir, initial_branch="main") | ||
|
|
There was a problem hiding this comment.
Trailing whitespace on this line should be removed to maintain code consistency and follow Python style guidelines.
|
Closed as introducing change at exercises repository instead |
This PR adds a new parameter,
include_remote_repo, to thecreate_repo_smithfunction. When set to True, repo-smith creates temporary directory in the user's system and initialises a bare git repository in it.create_repo_smith now returns a tuple of 2 RepoSmith objects, one representing the local repository and one representing the remote repository (if any).
Fixes #18