Skip to content

Commit ff0236f

Browse files
committed
test: fix ruff version check test
Refs: PT-1952
1 parent 8619096 commit ff0236f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

palvelutarjotin/tests/test_pre_commit_ruff_version.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
r"rev: v(\d+(\.\d+)+)\s*# ruff-pre-commit version"
55
)
66

7+
RUFF_VERSION_DEV_REQS_REGEX = re.compile(r"^ruff==(\d+(\.\d+)+)\s*\S$")
8+
79

810
def get_ruff_version_from_dev_requirements() -> str | None:
911
with open("./requirements-dev.txt") as file:
1012
dev_requirements = file.read()
1113
for line in dev_requirements.splitlines():
12-
if line.startswith("ruff=="):
13-
return line.split("==")[1].strip()
14+
match = RUFF_VERSION_DEV_REQS_REGEX.search(line)
15+
if match:
16+
return match.group(1)
1417
return None
1518

1619

0 commit comments

Comments
 (0)