-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor test_cli_prompt.py and add conftest.py
- Remove unnecessary imports and comments in test_cli_prompt.py - Move git_repo fixture to conftest.py - Update '--topic' option formatting in _cli.py
- Loading branch information
1 parent
8299aef
commit abdb108
Showing
3 changed files
with
29 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import os | ||
import shutil | ||
import tempfile | ||
import pytest | ||
from git import Repo | ||
|
||
|
||
@pytest.fixture(name='git_repo', scope='module') | ||
def fixture_git_repo(request): | ||
# Create a temporary directory | ||
repo_dir = tempfile.mkdtemp() | ||
|
||
# Initialize a new Git repository in the temporary directory | ||
Repo.init(repo_dir) | ||
|
||
# Change the current working directory to the temporary directory | ||
prev_cwd = os.getcwd() | ||
os.chdir(repo_dir) | ||
|
||
# Add a cleanup function to remove the temporary directory after the test | ||
def cleanup(): | ||
os.chdir(prev_cwd) | ||
shutil.rmtree(repo_dir) | ||
|
||
request.addfinalizer(cleanup) | ||
|
||
return repo_dir |
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