Skip to content

Commit ea5e531

Browse files
committed
Fix Ruff v0.14.11 warnings
1 parent c4aecc7 commit ea5e531

5 files changed

Lines changed: 15 additions & 7 deletions

File tree

tests/cli/cmd_repo/test_cmd_clone.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Tests for the 'docbuild repo clone' command."""
22

33
import logging
4+
import re
45
from unittest.mock import AsyncMock
56

67
import pytest
@@ -112,15 +113,16 @@ async def test_process_stitchnode_none(monkeypatch, tmp_path):
112113
(tmp_path / "config").mkdir()
113114
(tmp_path / "repos").mkdir()
114115

115-
with pytest.raises(ValueError, match="Stitch node could not be created."):
116+
with pytest.raises(ValueError,
117+
match=re.escape("Stitch node could not be created.")):
116118
await mod_process.process(context, repos=())
117119

118120

119121
async def test_process_configdir_none():
120122
context = DocBuildContext(envconfig={"paths": {}})
121123
with pytest.raises(
122124
ValueError,
123-
match="Could not get a value from envconfig.paths.config_dir",
125+
match=re.escape("Could not get a value from envconfig.paths.config_dir"),
124126
):
125127
await mod_process.process(context, repos=())
126128

@@ -129,6 +131,6 @@ async def test_process_repodir_none():
129131
context = DocBuildContext(envconfig={"paths": {"config_dir": "/dummy/config"}})
130132
with pytest.raises(
131133
ValueError,
132-
match="Could not get a value from envconfig.paths.repo_dir",
134+
match=re.escape("Could not get a value from envconfig.paths.repo_dir"),
133135
):
134136
await mod_process.process(context, repos=())

tests/cli/cmd_validate/test_process.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Tests for the XML validation process module."""
22

33
from pathlib import Path
4+
import re
45
from subprocess import CompletedProcess
56
from unittest.mock import AsyncMock, MagicMock, patch
67

@@ -58,7 +59,8 @@ async def test_process_file_with_generic_parsing_error(
5859

5960
async def test_process_no_envconfig(mock_context):
6061
mock_context.envconfig = None
61-
with pytest.raises(ValueError, match="No envconfig found in context."):
62+
with pytest.raises(ValueError,
63+
match=re.escape("No envconfig found in context.")):
6264
await process(mock_context, xmlfiles=(Path("dummy.xml"),))
6365

6466

tests/cli/cmd_validate/validate/test_cmd_validate.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from collections.abc import Iterator
44
from os import PathLike
55
from pathlib import Path
6+
import re
67
from subprocess import CompletedProcess
78
import tempfile
89
from unittest.mock import AsyncMock, Mock, patch
@@ -123,7 +124,8 @@ async def test_process_invalid_paths_config(self):
123124
context = Mock(spec=DocBuildContext)
124125
context.envconfig = {"paths": "not_a_dict"}
125126

126-
with pytest.raises(ValueError, match="'paths.config' must be a dictionary"):
127+
with pytest.raises(ValueError,
128+
match=re.escape("'paths.config' must be a dictionary")):
127129
await process_mod.process(context, [])
128130

129131
async def test_process_with_no_xml_files(self, mock_context, caplog):

tests/models/test_language.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def test_compare_with_one_language_and_with_different_object():
7373
def test_language_code_is_frozen():
7474
lang = LanguageCode(language="en-us")
7575

76-
with pytest.raises(ValidationError, match=".*frozen_instance.*"):
76+
with pytest.raises(ValidationError,
77+
match=r".*frozen_instance.*"):
7778
lang.language = "de-de"
7879

7980

tests/utils/test_pidlock.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from multiprocessing import Event
77
from pathlib import Path
88
import platform
9+
import re
910
import time
1011
from unittest.mock import Mock, patch
1112

@@ -143,7 +144,7 @@ def test_lock_is_reentrant_per_process(lock_setup):
143144
# (internal API misuse)
144145
with pytest.raises(
145146
RuntimeError,
146-
match="Lock already acquired by this PidFileLock instance."
147+
match=re.escape("Lock already acquired by this PidFileLock instance.")
147148
):
148149
with lock2:
149150
pass

0 commit comments

Comments
 (0)