10000 pytest plugin(hg): Set `HGRCPATH` for `hg_remote_repo_single_commit_p… · vcs-python/libvcs@c208b95 · GitHub
[go: up one dir, main page]

Skip to content

Commit c208b95

Browse files
committed
pytest plugin(hg): Set HGRCPATH for hg_remote_repo_single_commit_post_init()
1 parent 27ab59c commit c208b95

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/libvcs/pytest_plugin.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -558,12 +558,15 @@ def _create_hg_remote_repo(
558558
return remote_repo_path
559559

560560

561-
def hg_remote_repo_single_commit_post_init(remote_repo_path: pathlib.Path) -> None:
561+
def hg_remote_repo_single_commit_post_init(
562+
remote_repo_path: pathlib.Path,
563+
env: "_ENV | None" = None,
564+
) -> None:
562565
"""Post-initialization: Create a test mercurial repo with a single commit."""
563566
testfile_filename = "testfile.test"
564-
run(["touch", testfile_filename], cwd=remote_repo_path)
565-
run(["hg", "add", testfile_filename], cwd=remote_repo_path)
566-
run(["hg", "commit", "-m", "test file for hg repo"], cwd=remote_repo_path)
567+
run(["touch", testfile_filename], cwd=remote_repo_path, env=env)
568+
run(["hg", "add", testfile_filename], cwd=remote_repo_path, env=env)
569+
run(["hg", "commit", "-m", "test file for hg repo"], cwd=remote_repo_path, env=env)
567570

568571

569572
@pytest.fixture(scope="session")
@@ -625,10 +628,13 @@ def fn(
625628
def hg_remote_repo(
626629
remote_repos_path: pathlib.Path,
627630
create_hg_remote_repo: CreateRepoPytestFixtureFn,
631+
hgconfig: pathlib.Path,
628632
) -> pathlib.Path:
629633
"""Pre-made, file-based repo for push and pull."""
630634
repo_path = create_hg_remote_repo()
631-
hg_remote_repo_single_commit_post_init(remote_repo_path=repo_path)
635+
hg_remote_repo_single_commit_post_init(
636+
remote_repo_path=repo_path, env={"HGRCPATH": str(hgconfig)}
637+
)
632638
return repo_path
633639

634640

0 commit comments

Comments
 (0)
0