-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Presented hg_repo and git_repo as fixtures.
Closes #36
- Loading branch information
Showing
4 changed files
with
42 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,13 @@ | ||
import pytest | ||
|
||
import jaraco.path | ||
from jaraco import vcs | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def _isolate_home(tmp_home_dir): | ||
"""Isolate the tests from a developer's VCS config.""" | ||
|
||
|
||
def _ensure_present(repo): | ||
try: | ||
repo.version() | ||
except Exception: | ||
pytest.skip() | ||
|
||
|
||
@pytest.fixture | ||
def temp_work_dir(tmp_path, monkeypatch): | ||
monkeypatch.chdir(tmp_path) | ||
return tmp_path | ||
|
||
|
||
rev1 = dict( | ||
bar=dict( | ||
baz="", | ||
|
@@ -37,10 +23,8 @@ def temp_work_dir(tmp_path, monkeypatch): | |
|
||
|
||
@pytest.fixture | ||
def hg_repo(temp_work_dir): | ||
repo = vcs.Mercurial() | ||
_ensure_present(repo) | ||
repo._invoke('init', '.') | ||
def hg_repo(hg_repo): | ||
repo = hg_repo | ||
jaraco.path.build(rev1) | ||
repo._invoke('addremove') | ||
repo._invoke('ci', '-m', 'committed') | ||
|
@@ -50,12 +34,8 @@ def hg_repo(temp_work_dir): | |
|
||
|
||
@pytest.fixture | ||
def git_repo(temp_work_dir): | ||
repo = vcs.Git() | ||
_ensure_present(repo) | ||
repo._invoke('init') | ||
repo._invoke('config', 'user.email', '[email protected]') | ||
repo._invoke('config', 'user.name', 'Important User') | ||
def git_repo(git_repo): | ||
repo = git_repo | ||
jaraco.path.build(rev1) | ||
repo._invoke('add', '.') | ||
repo._invoke('commit', '-m', 'committed') | ||
|
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,34 @@ | ||
import pytest | ||
|
||
from .. import vcs | ||
|
||
|
||
def _ensure_present(repo): | ||
try: | ||
repo.version() | ||
except Exception: | ||
pytest.skip() | ||
|
||
|
||
@pytest.fixture | ||
def temp_work_dir(tmp_path, monkeypatch): | ||
monkeypatch.chdir(tmp_path) | ||
return tmp_path | ||
|
||
|
||
@pytest.fixture | ||
def hg_repo(temp_work_dir): | ||
repo = vcs.Mercurial() | ||
_ensure_present(repo) | ||
repo._invoke('init', '.') | ||
return repo | ||
|
||
|
||
@pytest.fixture | ||
def git_repo(temp_work_dir): | ||
repo = vcs.Git() | ||
_ensure_present(repo) | ||
repo._invoke('init') | ||
repo._invoke('config', 'user.email', '[email protected]') | ||
repo._invoke('config', 'user.name', 'Important User') | ||
return repo |
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 @@ | ||
Presented hg_repo and git_repo as fixtures. |
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