Skip to content

Commit 16657ef

Browse files
committed
fixing some ruff issues
1 parent 2196f87 commit 16657ef

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/py/tests/test_readme.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
import re
1212
import warnings
1313
from pathlib import Path
14-
from typing import Optional
14+
from typing import TYPE_CHECKING
1515

1616
import pytest
17-
from _pytest.capture import CaptureFixture
1817

18+
if TYPE_CHECKING:
19+
from _pytest.capture import CaptureFixture
1920

20-
def find_project_root(start_path: Optional[Path]) -> Path:
21+
22+
def find_project_root(start_path: Path | None) -> Path:
2123
"""Find the project root directory by looking for the .git folder.
2224
2325
This function iterates up the directory tree from the given starting path
@@ -96,7 +98,7 @@ def docstring(project_root: Path) -> str:
9698
return docstring
9799

98100
except FileNotFoundError:
99-
warnings.warn("README.md file not found")
101+
warnings.warn("README.md file not found", stacklevel=2)
100102
return ""
101103

102104

0 commit comments

Comments
 (0)