-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplified gitmanager and added tests (#72)
* Simplified gitmanager logic * Added some simple tests to gitmanager * Turned on tests in gitmanager
- Loading branch information
Showing
8 changed files
with
421 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from pathlib import Path | ||
import shutil | ||
import tempfile | ||
from typing import Generator | ||
|
||
from git.repo.base import Repo as GitRepo | ||
import pytest | ||
|
||
from dl_gitmanager.git_manager import GitManager | ||
from dl_gitmanager_tests.unit.git_tools import GitActionProcessor | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def base_repo_dir() -> Generator[Path, None, None]: | ||
dir_path = Path(tempfile.mkdtemp()) | ||
try: | ||
yield dir_path | ||
finally: | ||
shutil.rmtree(dir_path) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def git_action_proc(base_repo_dir: Path) -> GitActionProcessor: | ||
git_action_proc = GitActionProcessor.initialize_repo(base_repo_dir) | ||
git_action_proc.add_commit(message="Initial commit") | ||
git_action_proc.checkout_new_branch("main") | ||
return git_action_proc | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def git_manager(base_repo_dir: Path) -> GitManager: | ||
git_manager = GitManager(git_repo=GitRepo(path=base_repo_dir)) | ||
return git_manager |
Oops, something went wrong.