Skip to content

Commit 4e150ec

Browse files
committed
test: fix ruff version check test
Refs: PT-1952
1 parent 6c71786 commit 4e150ec

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

palvelutarjotin/tests/test_pre_commit_ruff_version.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
RUFF_VERSION_PRE_COMMIT_REGEX = re.compile(
44
r"rev: v(\d+(\.\d+)+)\s*# ruff-pre-commit version"
55
)
6+
RUFF_VERSION_DEV_REQS_REGEX = re.compile(r"^ruff==(\d+(\.\d+)+)\s*\S$")
67

78

89
def get_ruff_version_from_dev_requirements() -> str | None:
910
with open("./requirements-dev.txt") as file:
1011
dev_requirements = file.read()
1112
for line in dev_requirements.splitlines():
12-
if line.startswith("ruff=="):
13-
return line.split("==")[1].strip()
13+
match = RUFF_VERSION_DEV_REQS_REGEX.search(line)
14+
if match:
15+
return match.group(1)
1416
return None
1517

1618

0 commit comments

Comments
 (0)