Skip to content

Commit 0aea6d3

Browse files
committed
add tests for regular nitpick_ignore
1 parent bf2e69a commit 0aea6d3

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/test_config.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,34 @@ def test_check_enum_for_list_failed(logger):
311311
config.init_values()
312312
check_confval_types(None, config)
313313
assert logger.warning.called
314+
315+
316+
nitpick_warnings = [
317+
"WARNING: py:const reference target not found: prefix.anything.postfix",
318+
"WARNING: py:class reference target not found: prefix.anything",
319+
"WARNING: py:class reference target not found: anything.postfix",
320+
"WARNING: js:class reference target not found: prefix.anything.postfix",
321+
]
322+
323+
324+
@pytest.mark.sphinx(testroot='nitpicky-warnings')
325+
def test_nitpick_base(app, status, warning):
326+
app.builder.build_all()
327+
328+
warning = warning.getvalue().strip().split('\n')
329+
assert len(warning) == len(nitpick_warnings)
330+
for actual, expected in zip(warning, nitpick_warnings):
331+
assert expected in actual
332+
333+
334+
@pytest.mark.sphinx(testroot='nitpicky-warnings', confoverrides={
335+
'nitpick_ignore': [
336+
('py:const', 'prefix.anything.postfix'),
337+
('py:class', 'prefix.anything'),
338+
('py:class', 'anything.postfix'),
339+
('js:class', 'prefix.anything.postfix'),
340+
],
341+
})
342+
def test_nitpick_ignore(app, status, warning):
343+
app.builder.build_all()
344+
assert not len(warning.getvalue().strip())

0 commit comments

Comments
 (0)