@@ -15,6 +15,7 @@ def test_pre_commit_and_uv(
1515 # Arrange
1616 (tmp_path / "uv.lock" ).touch ()
1717 (tmp_path / ".pre-commit-config.yaml" ).touch ()
18+ (tmp_path / "ruff.toml" ).touch ()
1819
1920 # Act
2021 with change_cwd (tmp_path ), files_manager ():
@@ -32,6 +33,7 @@ def test_pre_commit_no_uv(
3233 ):
3334 # Arrange
3435 (tmp_path / ".pre-commit-config.yaml" ).touch ()
36+ (tmp_path / "ruff.toml" ).touch ()
3537
3638 # Act
3739 with change_cwd (tmp_path ), files_manager ():
@@ -47,6 +49,7 @@ def test_pre_commit_no_uv(
4749 def test_uv_only (self , tmp_path : Path , capfd : pytest .CaptureFixture [str ]):
4850 # Arrange
4951 (tmp_path / "uv.lock" ).touch ()
52+ (tmp_path / "ruff.toml" ).touch ()
5053
5154 # Act
5255 with change_cwd (tmp_path ), files_manager ():
@@ -58,6 +61,9 @@ def test_uv_only(self, tmp_path: Path, capfd: pytest.CaptureFixture[str]):
5861 assert out == ("☐ Run 'uv run lint-imports' to run Import Linter.\n " )
5962
6063 def test_basic (self , tmp_path : Path , capfd : pytest .CaptureFixture [str ]):
64+ # Arrange
65+ (tmp_path / "ruff.toml" ).touch ()
66+
6167 # Act
6268 with change_cwd (tmp_path ), files_manager ():
6369 ImportLinterTool ().print_how_to_use ()
@@ -66,3 +72,19 @@ def test_basic(self, tmp_path: Path, capfd: pytest.CaptureFixture[str]):
6672 out , err = capfd .readouterr ()
6773 assert not err
6874 assert out == ("☐ Run 'lint-imports' to run Import Linter.\n " )
75+
76+ def test_ruff_isnt_used (
77+ self , tmp_path : Path , capfd : pytest .CaptureFixture [str ]
78+ ):
79+ # Act
80+ with change_cwd (tmp_path ), files_manager ():
81+ ImportLinterTool ().print_how_to_use ()
82+
83+ # Assert
84+ out , err = capfd .readouterr ()
85+ assert not err
86+ assert out == (
87+ "ℹ Ensure '__init__.py' files are used in your packages.\n " # noqa: RUF001
88+ "ℹ For more info see <https://docs.python.org/3/tutorial/modules.html#packages>\n " # noqa: RUF001
89+ "☐ Run 'lint-imports' to run Import Linter.\n "
90+ )
0 commit comments