@@ -449,10 +449,34 @@ def svn_remote_repo_single_commit_post_init(remote_repo_path: pathlib.Path) -> N
449449 )
450450
451451
452- @pytest .fixture
452+ @pytest .fixture (scope = "session" )
453+ def empty_svn_repo_path (libvcs_test_cache_path : pathlib .Path ) -> pathlib .Path :
454+ """Return temporary directory to use for master-copy of a svn repo."""
455+ return libvcs_test_cache_path / "empty_svn_repo"
456+
457+
458+ @pytest .fixture (scope = "session" )
459+ @skip_if_svn_missing
460+ def empty_svn_repo (
461+ empty_svn_repo_path : pathlib .Path ,
462+ ) -> pathlib .Path :
463+ """Return factory to create svn remote repo to for clone / push purposes."""
464+ if empty_svn_repo_path .exists () and (empty_svn_repo_path / "conf" ).exists ():
465+ return empty_svn_repo_path
466+
467+ return _create_svn_remote_repo (
468+ remote_repos_path = empty_svn_repo_path .parent ,
469+ remote_repo_name = empty_svn_repo_path .stem ,
470+ remote_repo_post_init = None ,
471+ init_cmd_args = None ,
472+ )
473+
474+
475+ @pytest .fixture (scope = "session" )
453476@skip_if_svn_missing
454477def create_svn_remote_repo (
455478 remote_repos_path : pathlib .Path ,
479+ empty_svn_repo : pathlib .Path ,
456480) -> CreateRepoPytestFixtureFn :
457481 """Pre-made svn repo, bare, used as a file:// remote to checkout and commit to."""
458482
@@ -462,27 +486,43 @@ def fn(
462486 remote_repo_post_init : Optional [CreateRepoPostInitFn ] = None ,
463487 init_cmd_args : InitCmdArgs = None ,
464488 ) -> pathlib .Path :
465- return _create_svn_remote_repo (
466- remote_repos_path = remote_repos_path ,
467- remote_repo_name = remote_repo_name
468- if remote_repo_name is not None
469- else unique_repo_name (remote_repos_path = remote_repos_path ),
470- remote_repo_post_init = remote_repo_post_init ,
471- init_cmd_args = init_cmd_args ,
472- )
489+ if remote_repo_name is None :
490+ remote_repo_name = unique_repo_name (remote_repos_path = remote_repos_path )
491+ remote_repo_path = remote_repos_path / remote_repo_name
492+
493+ shutil .copytree (empty_svn_repo , remote_repo_path )
494+
495+ if remote_repo_post_init is not None and callable (remote_repo_post_init ):
496+ remote_repo_post_init (remote_repo_path = remote_repo_path )
497+
498+ assert empty_svn_repo .exists ()
499+
500+ assert remote_repo_path .exists ()
501+
502+ return remote_repo_path
473503
474504 return fn
475505
476506
477- @pytest .fixture
507+ @pytest .fixture ( scope = "session" )
478508@skip_if_svn_missing
479- def svn_remote_repo (remote_repos_path : pathlib .Path ) -> pathlib .Path :
509+ def svn_remote_repo (
510+ create_svn_remote_repo : CreateRepoPytestFixtureFn ,
511+ ) -> pathlib .Path :
480512 """Pre-made. Local file:// based SVN server."""
481- return _create_svn_remote_repo (
482- remote_repos_path = remote_repos_path ,
483- remote_repo_name = "svn_server_dir" ,
484- remote_repo_post_init = None ,
485- )
513+ repo_path = create_svn_remote_repo ()
514+ return repo_path
515+
516+
517+ @pytest .fixture (scope = "session" )
518+ @skip_if_svn_missing
519+ def svn_remote_repo_with_files (
520+ create_svn_remote_repo : CreateRepoPytestFixtureFn ,
521+ ) -> pathlib .Path :
522+ """Pre-made. Local file:// based SVN server."""
523+ repo_path = create_svn_remote_repo ()
524+ svn_remote_repo_single_commit_post_init (remote_repo_path = repo_path )
525+ return repo_path
486526
487527
488528def _create_hg_remote_repo (
0 commit comments