DOCS: change doc tests (#10213)

* change doc tests

* fixes

* fixes

* fixes

* fixes

* fixes
This commit is contained in:
Nikolay Tyukaev 2022-02-09 18:28:54 +03:00 committed by GitHub
parent c0a375f844
commit e81ca9f975
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 30 deletions

View File

@ -59,7 +59,4 @@ openvino_docs_ie_dg_lpt_updatesharedprecisionpreserved.rst
openvino_docs_ie_dg_lpt_variadicsplittransformation.rst openvino_docs_ie_dg_lpt_variadicsplittransformation.rst
openvino_docs_ie_plugin_dg_lp_representation.rst openvino_docs_ie_plugin_dg_lp_representation.rst
openvino_docs_ie_dg_lpt.rst openvino_docs_ie_dg_lpt.rst
omz_models_model_age_gender_recognition_retail_0013.rst
omz_models_model_emotions_recognition_retail_0003.rst
ngraph_transformation.rst
notebooks/notebook_utils-with-output.rst notebooks/notebook_utils-with-output.rst

View File

@ -114,17 +114,21 @@ def pytest_generate_tests(metafunc):
suppress_warnings.append(sphinx_ref_pattern2) suppress_warnings.append(sphinx_ref_pattern2)
# read doxygen log # read doxygen log
doxy_parser = LogParser(metafunc.config.getoption('doxygen')) doxy_parser = LogParser(metafunc.config.getoption('doxygen'),
strip=metafunc.config.getoption('doxygen_strip'),
xfail_list=metafunc.config.getoption('doxygen_xfail'),
suppress_warnings=suppress_warnings)
doxy_parser.parse() doxy_parser.parse()
doxygen_warnings = doxy_parser.filter(strip=metafunc.config.getoption('doxygen_strip'), doxygen_warnings = doxy_parser.filter()
xfail_list=metafunc.config.getoption('doxygen_xfail'),
suppress_warnings=suppress_warnings)
sphinx_parser = LogParser(metafunc.config.getoption('sphinx')) # read sphinx log
sphinx_parser = LogParser(metafunc.config.getoption('sphinx'),
strip=metafunc.config.getoption('sphinx_strip'),
xfail_list=metafunc.config.getoption('doxygen_xfail'),
suppress_warnings=suppress_warnings
)
sphinx_parser.parse() sphinx_parser.parse()
sphinx_warnings = sphinx_parser.filter(strip=metafunc.config.getoption('sphinx_strip'), sphinx_warnings = sphinx_parser.filter()
xfail_list=metafunc.config.getoption('doxygen_xfail'),
suppress_warnings=suppress_warnings)
all_warnings = dict() all_warnings = dict()
all_warnings.update(doxygen_warnings) all_warnings.update(doxygen_warnings)

View File

@ -22,12 +22,20 @@ class LogParser:
# a line number, and an error,warning or critical # a line number, and an error,warning or critical
regex = r'^(?!\*)(.*?):?([0-9]*):? ?(warning|error|critical): (.+)' regex = r'^(?!\*)(.*?):?([0-9]*):? ?(warning|error|critical): (.+)'
def __init__(self, log: Path): def __init__(self, log: Path, strip: str, xfail_list: list, suppress_warnings: list):
""" """
Initialize a LogParser object for parsing doxygen and sphinx logs Initialize a LogParser object for parsing doxygen and sphinx logs
:param log: Path to a log file represented as a `pathlib.Path` object :param log: Path to a log file represented as a `pathlib.Path` object
:param strip: A part of the filepath that should be removed
:param suppress_warnings: A list of warnings that should be ignored
:param xfail_list: A list of filepaths that should be ignored
""" """
self.log = log self.log = log
if not strip.endswith('/'):
strip = strip + '/'
self.strip = strip.replace('\\', '/').lower()
self.xfail_list = xfail_list
self.suppress_warnings = suppress_warnings
self.out = dict() self.out = dict()
def get_match(self, line: str): def get_match(self, line: str):
@ -44,39 +52,35 @@ class LogParser:
line = line.replace(sym, '') line = line.replace(sym, '')
return line.strip().lower() return line.strip().lower()
def strip_path(self, path, strip='build/docs'): def strip_path(self, path):
""" """
Strip `path` components ends on `strip` Strip `path` components ends on `strip`
""" """
path = path.replace('\\', '/').lower() path = path.replace('\\', '/').lower()
strip = strip.replace('\\', '/').lower()
if not strip.endswith('/'): new_path = path.split(self.strip)[-1]
strip = strip + '/'
new_path = path.split(strip)[-1]
if new_path.startswith('build/docs/'): if new_path.startswith('build/docs/'):
new_path = new_path.split('build/docs/')[-1] new_path = new_path.split('build/docs/')[-1]
return new_path return new_path
def filter(self, strip='build/docs', suppress_warnings=tuple(), xfail_list=tuple()): def filter(self):
""" """
Filter out a log file to remove files or warning based on the values provided in `strip`, Filter out a log file to remove files or warning based on the values provided in `strip`,
`suppress_warnings`, and 'xfail_list` `suppress_warnings`, and 'xfail_list`
:param strip: A part of the filepath that should be removed
:param suppress_warnings: A list of warnings that should be ignored
:param xfail_list: A list of filepaths that should be ignored
:return: filtered dict in which keys are filepaths and values are warnings/errors
""" """
filtered_out = dict() filtered_out = dict()
for filepath, warnings in self.out.items(): for filepath, warnings in self.out.items():
filepath = self.strip_path(filepath, strip) filepath = self.strip_path(filepath)
if filepath in xfail_list: if filepath in self.xfail_list:
continue continue
warnings = list(filter(lambda item: not any([re.search(re.compile(warning, re.IGNORECASE), item) warnings = list(filter(lambda item: not self.is_suppressed(item), warnings))
for warning in suppress_warnings]), warnings))
if warnings: if warnings:
filtered_out[filepath] = warnings filtered_out[filepath] = warnings
return filtered_out return filtered_out
def is_suppressed(self, line):
return any([re.search(re.compile(warning, re.IGNORECASE), line) for warning in self.suppress_warnings])
def parse(self): def parse(self):
""" """
Parse a log file to convert it to a structured format Parse a log file to convert it to a structured format
@ -92,7 +96,7 @@ class LogParser:
match = self.get_match(line) match = self.get_match(line)
# if match is true then we found a line containing a filepath, # if match is true then we found a line containing a filepath,
# a line number, and a warning/error # a line number, and a warning/error
if match: if match and not self.is_suppressed(line):
filepath = match.group(1) or 'warning' filepath = match.group(1) or 'warning'
linenum = match.group(2) linenum = match.group(2)
warning = match.group(4) warning = match.group(4)

View File

@ -42,7 +42,7 @@ template .+
openvino_suppress_deprecated_start template class openvino_api ngraph::variantimpl openvino_suppress_deprecated_start template class openvino_api ngraph::variantimpl
@copybrief or @copydoc target @copybrief or @copydoc target
while setting up extension conf.py: csv directory not found while setting up extension conf.py: csv directory not found
autosummary: failed to import openvino.inference_engine autosummary: failed to import
unknown target name: unknown target name:
undefined substitution referenced undefined substitution referenced
detailed documentation detailed documentation
@ -69,12 +69,11 @@ example of converting
step 2: build the software required for all roles step 2: build the software required for all roles
step 4: receive and load the access controlled model into step 4: receive and load the access controlled model into
^undefined label: ^undefined label:
\[autosummary\] failed to import \'openvino.inference_engine\' \[autosummary\] failed to import
inheritance graph for inheritance graph for
^convert darknet ^convert darknet
anonymous hyperlink mismatch: 4 references but 0 targets anonymous hyperlink mismatch: 4 references but 0 targets
see "backrefs" attribute for ids see "backrefs" attribute for ids
\[autosummary\] failed to import openvino.inference_engine.
doing serial read doing serial read
doing serial write doing serial write
possible hints: possible hints:
@ -92,3 +91,11 @@ unable to resolve reference to \'http
unexpected html tag unexpected html tag
field list ends without a blank line field list ends without a blank line
bullet list ends without a blank line bullet list ends without a blank line
Error parsing content block for the \"list-table\" directive
more than one target found for cross-reference
unexpected indentation
definition list ends without
duplicate object description of
explicit markup ends without a blank line
\* keyerror:
\* modulenotfounderror