fix doc tests (#9400)

This commit is contained in:
Nikolay Tyukaev 2021-12-23 18:15:09 +03:00 committed by GitHub
parent f91999b1bc
commit 9e91cf5c08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 7 deletions

View File

@ -14,11 +14,10 @@ with errors can be skipped (--doxygen-skip) or excluded temporary
Usage:
pytest --doxygen doxygen.log --html doc-generation.html test_doc-generation.py
"""
from inspect import getsourcefile
from contextlib import contextmanager
import os
import re
import copy
import pytest
from distutils.util import strtobool
from utils.log import parse
@ -105,7 +104,16 @@ def pytest_generate_tests(metafunc):
exclude_links.remove('ovms')
filtered_keys = filter(lambda line: not any([line.startswith(repo) for repo in exclude_links]), all_files)
files = {key: all_files[key] for key in filtered_keys}
files_with_errors = {key: all_files[key] for key in filtered_keys}
ref_pattern = "unable to resolve reference to '{}"
for file, errors in copy.deepcopy(files_with_errors).items():
for error in errors:
for ex_link in exclude_links:
if re.match(re.compile(ref_pattern.format(ex_link)), error):
files_with_errors[file].remove(error)
if not len(errors):
files_with_errors.pop(file)
# read mute lists
marks = dict()
marks.update(
@ -120,6 +128,6 @@ def pytest_generate_tests(metafunc):
metafunc.parametrize(
'doxygen_errors', [
pytest.param(errors, marks=marks[file])
if file in marks else errors for file, errors in files.items()
if file in marks else errors for file, errors in files_with_errors.items()
],
ids=list(files.keys()))
ids=list(files_with_errors.keys()))