@@ -115,8 +115,14 @@ def test_pre_commit_integration(
115115 use_codespell ()
116116
117117 # Assert
118+ # Check dependencies - shouldn't have installed codespell
119+ dev_deps = get_deps_from_group ("dev" )
120+ assert all (dep .name != "codespell" for dep in dev_deps )
121+
122+ # Check hook names
118123 hook_names = get_hook_names ()
119- assert "codespell" in hook_names
124+ assert "codespell" in hook_names
125+ # Check output
120126 out , err = capfd .readouterr ()
121127 assert not err
122128 assert out == (
@@ -676,9 +682,28 @@ def test_pyproject_fmt_used(self, uv_init_repo_dir: Path):
676682
677683 # Assert
678684 hook_names = get_hook_names ()
685+ assert "pyproject-fmt" in hook_names
686+
679687 dev_deps = get_deps_from_group ("dev" )
680- assert "pyproject-fmt" in hook_names
681- assert "pyproject-fmt" not in dev_deps
688+ for dev_dep in dev_deps :
689+ assert dev_dep .name != "pyproject-fmt"
690+
691+ @pytest .mark .usefixtures ("_vary_network_conn" )
692+ def test_codespell_used (self , uv_init_repo_dir : Path ):
693+ with change_cwd (uv_init_repo_dir ):
694+ # Arrange
695+ use_codespell ()
696+
697+ # Act
698+ use_pre_commit ()
699+
700+ # Assert
701+ hook_names = get_hook_names ()
702+ assert "codespell" in hook_names
703+
704+ dev_deps = get_deps_from_group ("dev" )
705+ for dep in dev_deps :
706+ assert dep .name != "codespell"
682707
683708 class TestRemove :
684709 @pytest .mark .usefixtures ("_vary_network_conn" )
@@ -776,6 +801,31 @@ def test_pyproject_fmt_used(
776801 "☐ Run 'pyproject-fmt pyproject.toml' to run pyproject-fmt.\n "
777802 )
778803
804+ @pytest .mark .usefixtures ("_vary_network_conn" )
805+ def test_codepsell_used (
806+ self , uv_init_dir : Path , capfd : pytest .CaptureFixture [str ]
807+ ):
808+ with change_cwd (uv_init_dir ):
809+ # Arrange
810+ with usethis_config .set (quiet = True ):
811+ use_pre_commit ()
812+ use_codespell ()
813+ capfd .readouterr ()
814+
815+ # Act
816+ use_pre_commit (remove = True )
817+
818+ # Assert
819+ out , err = capfd .readouterr ()
820+ assert not err
821+ assert out == (
822+ "☐ Run 'uvx pre-commit uninstall' to deregister pre-commit with git.\n "
823+ "✔ Removing '.pre-commit-config.yaml'.\n "
824+ "✔ Removing dependency 'pre-commit' from the 'dev' group in 'pyproject.toml'.\n "
825+ "✔ Adding dependency 'codespell' to the 'dev' group in 'pyproject.toml'.\n "
826+ "☐ Run 'codespell' to run the Codespell spellchecker.\n "
827+ )
828+
779829 class TestBitbucketCIIntegration :
780830 def test_prexisting (self , uv_init_repo_dir : Path ):
781831 # Arrange
0 commit comments