@@ -225,24 +225,24 @@ def test_run_deptry_pass(self, uv_init_dir: Path):
225225
226226 @pytest .mark .usefixtures ("_vary_network_conn" )
227227 def test_pre_commit_after (
228- self , uv_init_repo_dir : Path , capfd : pytest .CaptureFixture [str ]
228+ self , uv_env_dir : Path , capfd : pytest .CaptureFixture [str ]
229229 ):
230230 # Act
231- with change_cwd (uv_init_repo_dir ):
231+ with change_cwd (uv_env_dir ):
232232 use_deptry ()
233233 use_pre_commit ()
234234
235235 # Assert
236236 hook_names = get_hook_names ()
237237
238238 # 1. File exists
239- assert (uv_init_repo_dir / ".pre-commit-config.yaml" ).exists ()
239+ assert (uv_env_dir / ".pre-commit-config.yaml" ).exists ()
240240
241241 # 2. Hook is in the file
242242 assert "deptry" in hook_names
243243
244244 # 3. Test file contents
245- assert (uv_init_repo_dir / ".pre-commit-config.yaml" ).read_text () == (
245+ assert (uv_env_dir / ".pre-commit-config.yaml" ).read_text () == (
246246 """\
247247 repos:
248248 - repo: local
@@ -459,9 +459,9 @@ def test_remove(
459459class TestPreCommit :
460460 class TestAdd :
461461 @pytest .mark .usefixtures ("_vary_network_conn" )
462- def test_fresh (self , uv_init_repo_dir : Path , capfd : pytest .CaptureFixture [str ]):
462+ def test_fresh (self , uv_env_dir : Path , capfd : pytest .CaptureFixture [str ]):
463463 # Act
464- with change_cwd (uv_init_repo_dir ):
464+ with change_cwd (uv_env_dir ):
465465 use_pre_commit ()
466466
467467 # Assert
@@ -483,8 +483,8 @@ def test_fresh(self, uv_init_repo_dir: Path, capfd: pytest.CaptureFixture[str]):
483483 "☐ Run 'pre-commit run --all-files' to run the hooks manually.\n "
484484 )
485485 # Config file
486- assert (uv_init_repo_dir / ".pre-commit-config.yaml" ).exists ()
487- contents = (uv_init_repo_dir / ".pre-commit-config.yaml" ).read_text ()
486+ assert (uv_env_dir / ".pre-commit-config.yaml" ).exists ()
487+ contents = (uv_env_dir / ".pre-commit-config.yaml" ).read_text ()
488488 assert contents == (
489489 """\
490490 repos:
@@ -531,28 +531,28 @@ def test_config_file_already_exists(self, uv_init_repo_dir: Path):
531531 )
532532
533533 @pytest .mark .usefixtures ("_vary_network_conn" )
534- def test_bad_commit (self , uv_init_repo_dir : Path ):
534+ def test_bad_commit (self , uv_env_dir : Path ):
535535 # Act
536- with change_cwd (uv_init_repo_dir ):
536+ with change_cwd (uv_env_dir ):
537537 use_pre_commit ()
538- subprocess .run (["git" , "add" , "." ], cwd = uv_init_repo_dir , check = True )
538+ subprocess .run (["git" , "add" , "." ], cwd = uv_env_dir , check = True )
539539 subprocess .run (
540- ["git" , "commit" , "-m" , "Good commit" ], cwd = uv_init_repo_dir , check = True
540+ ["git" , "commit" , "-m" , "Good commit" ], cwd = uv_env_dir , check = True
541541 )
542542
543543 # Assert
544- (uv_init_repo_dir / "pyproject.toml" ).write_text ("[" )
545- subprocess .run (["git" , "add" , "." ], cwd = uv_init_repo_dir , check = True )
544+ (uv_env_dir / "pyproject.toml" ).write_text ("[" )
545+ subprocess .run (["git" , "add" , "." ], cwd = uv_env_dir , check = True )
546546 with pytest .raises (subprocess .CalledProcessError ):
547547 subprocess .run (
548548 ["git" , "commit" , "-m" , "Bad commit" ],
549- cwd = uv_init_repo_dir ,
549+ cwd = uv_env_dir ,
550550 check = True ,
551551 )
552552
553553 @pytest .mark .usefixtures ("_vary_network_conn" )
554- def test_requirements_txt_used (self , uv_init_repo_dir : Path ):
555- with change_cwd (uv_init_repo_dir ):
554+ def test_requirements_txt_used (self , uv_env_dir : Path ):
555+ with change_cwd (uv_env_dir ):
556556 # Arrange
557557 use_requirements_txt ()
558558
@@ -603,11 +603,9 @@ def test_dep(self, uv_init_repo_dir: Path):
603603 assert not get_deps_from_group ("dev" )
604604
605605 @pytest .mark .usefixtures ("_vary_network_conn" )
606- def test_stdout (
607- self , uv_init_repo_dir : Path , capfd : pytest .CaptureFixture [str ]
608- ):
606+ def test_stdout (self , uv_env_dir : Path , capfd : pytest .CaptureFixture [str ]):
609607 # Arrange
610- (uv_init_repo_dir / ".pre-commit-config.yaml" ).write_text (
608+ (uv_env_dir / ".pre-commit-config.yaml" ).write_text (
611609 """\
612610 repos:
613611 - repo: local
@@ -617,7 +615,7 @@ def test_stdout(
617615 )
618616
619617 # Act
620- with change_cwd (uv_init_repo_dir ):
618+ with change_cwd (uv_env_dir ):
621619 use_pre_commit (remove = True )
622620
623621 # Assert
@@ -632,9 +630,9 @@ def test_stdout(
632630
633631 @pytest .mark .usefixtures ("_vary_network_conn" )
634632 def test_requirements_txt_used (
635- self , uv_init_repo_dir : Path , capfd : pytest .CaptureFixture [str ]
633+ self , uv_env_dir : Path , capfd : pytest .CaptureFixture [str ]
636634 ):
637- with change_cwd (uv_init_repo_dir ):
635+ with change_cwd (uv_env_dir ):
638636 # Arrange
639637 with usethis_config .set (quiet = True ):
640638 use_pre_commit ()
@@ -654,9 +652,9 @@ def test_requirements_txt_used(
654652
655653 @pytest .mark .usefixtures ("_vary_network_conn" )
656654 def test_pyproject_fmt_used (
657- self , uv_init_repo_dir : Path , capfd : pytest .CaptureFixture [str ]
655+ self , uv_env_dir : Path , capfd : pytest .CaptureFixture [str ]
658656 ):
659- with change_cwd (uv_init_repo_dir ):
657+ with change_cwd (uv_env_dir ):
660658 # Arrange
661659 with usethis_config .set (quiet = True ):
662660 use_pre_commit ()
@@ -692,13 +690,12 @@ def test_prexisting(self, uv_init_repo_dir: Path):
692690 contents = (uv_init_repo_dir / "bitbucket-pipelines.yml" ).read_text ()
693691 assert "pre-commit" in contents
694692
695- def test_remove (
696- self , uv_init_repo_dir : Path , capfd : pytest .CaptureFixture [str ]
697- ):
693+ def test_remove (self , uv_env_dir : Path , capfd : pytest .CaptureFixture [str ]):
698694 # Arrange
699- with change_cwd (uv_init_repo_dir ), usethis_config . set ( quiet = True ):
695+ with change_cwd (uv_env_dir ):
700696 use_pre_commit ()
701- (uv_init_repo_dir / "bitbucket-pipelines.yml" ).write_text (
697+ capfd .readouterr ()
698+ (uv_env_dir / "bitbucket-pipelines.yml" ).write_text (
702699 """\
703700 image: atlassian/default-image:3
704701pipelines:
@@ -711,11 +708,11 @@ def test_remove(
711708 )
712709
713710 # Act
714- with change_cwd (uv_init_repo_dir ):
711+ with change_cwd (uv_env_dir ):
715712 use_pre_commit (remove = True )
716713
717714 # Assert
718- contents = (uv_init_repo_dir / "bitbucket-pipelines.yml" ).read_text ()
715+ contents = (uv_env_dir / "bitbucket-pipelines.yml" ).read_text ()
719716 assert (
720717 contents
721718 == """\
@@ -1409,7 +1406,7 @@ def test_start_from_uv_init(
14091406 self , uv_init_dir : Path , capfd : pytest .CaptureFixture [str ]
14101407 ):
14111408 # Act
1412- with change_cwd (uv_init_dir ):
1409+ with change_cwd (uv_init_dir ), usethis_config . set ( frozen = False ) :
14131410 use_requirements_txt ()
14141411
14151412 # Assert
@@ -1425,7 +1422,7 @@ def test_start_from_uv_init(
14251422 def test_start_from_uv_locked (
14261423 self , uv_init_dir : Path , capfd : pytest .CaptureFixture [str ]
14271424 ):
1428- with change_cwd (uv_init_dir ):
1425+ with change_cwd (uv_init_dir ), usethis_config . set ( frozen = False ) :
14291426 # Arrange
14301427 call_uv_subprocess (["lock" ])
14311428
@@ -1444,10 +1441,10 @@ def test_start_from_uv_locked(
14441441 def test_pre_commit (
14451442 self , uv_init_repo_dir : Path , capfd : pytest .CaptureFixture [str ]
14461443 ):
1447- with change_cwd (uv_init_repo_dir ):
1444+ with change_cwd (uv_init_repo_dir ), usethis_config . set ( frozen = False ) :
14481445 # Arrange
1449- with usethis_config . set ( quiet = True ):
1450- use_pre_commit ()
1446+ use_pre_commit ()
1447+ capfd . readouterr ()
14511448
14521449 # Act
14531450 use_requirements_txt ()
0 commit comments