@@ -323,6 +323,21 @@ def test_bitbucket_integration(self, uv_init_repo_dir: Path):
323323 contents = (uv_init_repo_dir / "bitbucket-pipelines.yml" ).read_text ()
324324 assert "deptry" not in contents
325325
326+ def test_use_deptry_removes_config (self , tmp_path : Path ):
327+ """Test that use_deptry removes the tool's config when removing."""
328+ # Arrange
329+ pyproject = tmp_path / "pyproject.toml"
330+ pyproject .write_text ("""[tool.deptry]
331+ ignore_missing = ["pytest"]
332+ """ )
333+
334+ # Act
335+ with change_cwd (tmp_path ):
336+ use_deptry (remove = True )
337+
338+ # Assert
339+ assert "[tool.deptry]" not in pyproject .read_text ()
340+
326341 class TestPreCommitIntegration :
327342 @pytest .mark .usefixtures ("_vary_network_conn" )
328343 def test_pre_commit_first (
@@ -606,14 +621,14 @@ def test_requirements_txt_used(
606621 # Act
607622 use_pre_commit (remove = True )
608623
609- # Assert
610- out , _ = capfd .readouterr ()
611- assert out == (
612- "✔ Ensuring pre-commit hooks are uninstalled.\n "
613- "✔ Removing '.pre-commit-config.yaml'.\n "
614- "✔ Removing dependency 'pre-commit' from the 'dev' group in 'pyproject.toml'.\n "
615- "☐ Run 'uv export --no-dev --output-file=requirements.txt' to write \n 'requirements.txt'.\n "
616- )
624+ # Assert
625+ out , _ = capfd .readouterr ()
626+ assert out == (
627+ "✔ Ensuring pre-commit hooks are uninstalled.\n "
628+ "✔ Removing '.pre-commit-config.yaml'.\n "
629+ "✔ Removing dependency 'pre-commit' from the 'dev' group in 'pyproject.toml'.\n "
630+ "☐ Run 'uv export --no-dev --output-file=requirements.txt' to write \n 'requirements.txt'.\n "
631+ )
617632
618633 @pytest .mark .usefixtures ("_vary_network_conn" )
619634 def test_pyproject_fmt_used (
@@ -628,15 +643,15 @@ def test_pyproject_fmt_used(
628643 # Act
629644 use_pre_commit (remove = True )
630645
631- # Assert
632- out , _ = capfd .readouterr ()
633- assert out == (
634- "✔ Ensuring pre-commit hooks are uninstalled.\n "
635- "✔ Removing '.pre-commit-config.yaml'.\n "
636- "✔ Removing dependency 'pre-commit' from the 'dev' group in 'pyproject.toml'.\n "
637- "✔ Adding dependency 'pyproject-fmt' to the 'dev' group in 'pyproject.toml'.\n "
638- "☐ Run 'pyproject-fmt pyproject.toml' to run pyproject-fmt.\n "
639- )
646+ # Assert
647+ out , _ = capfd .readouterr ()
648+ assert out == (
649+ "✔ Ensuring pre-commit hooks are uninstalled.\n "
650+ "✔ Removing '.pre-commit-config.yaml'.\n "
651+ "✔ Removing dependency 'pre-commit' from the 'dev' group in 'pyproject.toml'.\n "
652+ "✔ Adding dependency 'pyproject-fmt' to the 'dev' group in 'pyproject.toml'.\n "
653+ "☐ Run 'pyproject-fmt pyproject.toml' to run pyproject-fmt.\n "
654+ )
640655
641656 class TestBitbucketCIIntegration :
642657 def test_prexisting (self , uv_init_repo_dir : Path ):
0 commit comments