Skip to content

Commit f8104de

Browse files
committed
pytest_plugin(fix[svn_repo]): populate clone cache
why: The svn_repo cache was dead. The cache-miss branch checked out to projects_path instead of master_copy, so master_copy was never written, the cache never hit, and new_checkout_path/unique_repo_name were unused; every svn test re-ran a full checkout. (Isolation was unaffected since projects_path is function-scoped.) what: - Build master_copy once via obtain(), then copytree to an isolated checkout for every consumer, mirroring git_repo/hg_repo
1 parent e088abc commit f8104de

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

src/libvcs/pytest_plugin.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -781,19 +781,20 @@ def svn_repo(
781781
new_checkout_path = projects_path / remote_repo_name
782782
master_copy = remote_repos_path / "svn_repo"
783783

784-
if master_copy.exists():
785-
shutil.copytree(master_copy, new_checkout_path)
786-
return SvnSync(
784+
# Build the master copy once as a pristine, read-only cache. Every consumer
785+
# gets an isolated copytree of it (including the first), so a test that
786+
# mutates its checkout cannot pollute the cache for later tests.
787+
if not master_copy.exists():
788+
SvnSync(
787789
url=f"file://{svn_remote_repo}",
788-
path=str(new_checkout_path),
789-
)
790+
path=master_copy,
791+
).obtain()
790792

791-
svn_repo = SvnSync(
793+
shutil.copytree(master_copy, new_checkout_path)
794+
return SvnSync(
792795
url=f"file://{svn_remote_repo}",
793-
path=str(projects_path / "svn_repo"),
796+
path=str(new_checkout_path),
794797
)
795-
svn_repo.obtain()
796-
return svn_repo
797798

798799

799800
@pytest.fixture

0 commit comments

Comments
 (0)