DOCS: change doc tests (#10213)
* change doc tests * fixes * fixes * fixes * fixes * fixes
This commit is contained in:
parent
c0a375f844
commit
e81ca9f975
@ -59,7 +59,4 @@ openvino_docs_ie_dg_lpt_updatesharedprecisionpreserved.rst
|
||||
openvino_docs_ie_dg_lpt_variadicsplittransformation.rst
|
||||
openvino_docs_ie_plugin_dg_lp_representation.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
|
||||
|
@ -114,17 +114,21 @@ def pytest_generate_tests(metafunc):
|
||||
suppress_warnings.append(sphinx_ref_pattern2)
|
||||
|
||||
# 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()
|
||||
doxygen_warnings = doxy_parser.filter(strip=metafunc.config.getoption('doxygen_strip'),
|
||||
xfail_list=metafunc.config.getoption('doxygen_xfail'),
|
||||
suppress_warnings=suppress_warnings)
|
||||
doxygen_warnings = doxy_parser.filter()
|
||||
|
||||
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_warnings = sphinx_parser.filter(strip=metafunc.config.getoption('sphinx_strip'),
|
||||
xfail_list=metafunc.config.getoption('doxygen_xfail'),
|
||||
suppress_warnings=suppress_warnings)
|
||||
sphinx_warnings = sphinx_parser.filter()
|
||||
|
||||
all_warnings = dict()
|
||||
all_warnings.update(doxygen_warnings)
|
||||
|
@ -22,12 +22,20 @@ class LogParser:
|
||||
# a line number, and an error,warning or 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
|
||||
: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
|
||||
if not strip.endswith('/'):
|
||||
strip = strip + '/'
|
||||
self.strip = strip.replace('\\', '/').lower()
|
||||
self.xfail_list = xfail_list
|
||||
self.suppress_warnings = suppress_warnings
|
||||
self.out = dict()
|
||||
|
||||
def get_match(self, line: str):
|
||||
@ -44,39 +52,35 @@ class LogParser:
|
||||
line = line.replace(sym, '')
|
||||
return line.strip().lower()
|
||||
|
||||
def strip_path(self, path, strip='build/docs'):
|
||||
def strip_path(self, path):
|
||||
"""
|
||||
Strip `path` components ends on `strip`
|
||||
"""
|
||||
path = path.replace('\\', '/').lower()
|
||||
strip = strip.replace('\\', '/').lower()
|
||||
if not strip.endswith('/'):
|
||||
strip = strip + '/'
|
||||
new_path = path.split(strip)[-1]
|
||||
|
||||
new_path = path.split(self.strip)[-1]
|
||||
if new_path.startswith('build/docs/'):
|
||||
new_path = new_path.split('build/docs/')[-1]
|
||||
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`,
|
||||
`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()
|
||||
for filepath, warnings in self.out.items():
|
||||
filepath = self.strip_path(filepath, strip)
|
||||
if filepath in xfail_list:
|
||||
filepath = self.strip_path(filepath)
|
||||
if filepath in self.xfail_list:
|
||||
continue
|
||||
warnings = list(filter(lambda item: not any([re.search(re.compile(warning, re.IGNORECASE), item)
|
||||
for warning in suppress_warnings]), warnings))
|
||||
warnings = list(filter(lambda item: not self.is_suppressed(item), warnings))
|
||||
if warnings:
|
||||
filtered_out[filepath] = warnings
|
||||
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):
|
||||
"""
|
||||
Parse a log file to convert it to a structured format
|
||||
@ -92,7 +96,7 @@ class LogParser:
|
||||
match = self.get_match(line)
|
||||
# if match is true then we found a line containing a filepath,
|
||||
# a line number, and a warning/error
|
||||
if match:
|
||||
if match and not self.is_suppressed(line):
|
||||
filepath = match.group(1) or 'warning'
|
||||
linenum = match.group(2)
|
||||
warning = match.group(4)
|
||||
|
@ -42,7 +42,7 @@ template .+
|
||||
openvino_suppress_deprecated_start template class openvino_api ngraph::variantimpl
|
||||
@copybrief or @copydoc target
|
||||
while setting up extension conf.py: csv directory not found
|
||||
autosummary: failed to import openvino.inference_engine
|
||||
autosummary: failed to import
|
||||
unknown target name:
|
||||
undefined substitution referenced
|
||||
detailed documentation
|
||||
@ -69,12 +69,11 @@ example of converting
|
||||
step 2: build the software required for all roles
|
||||
step 4: receive and load the access controlled model into
|
||||
^undefined label:
|
||||
\[autosummary\] failed to import \'openvino.inference_engine\'
|
||||
\[autosummary\] failed to import
|
||||
inheritance graph for
|
||||
^convert darknet
|
||||
anonymous hyperlink mismatch: 4 references but 0 targets
|
||||
see "backrefs" attribute for ids
|
||||
\[autosummary\] failed to import openvino.inference_engine.
|
||||
doing serial read
|
||||
doing serial write
|
||||
possible hints:
|
||||
@ -92,3 +91,11 @@ unable to resolve reference to \'http
|
||||
unexpected html tag
|
||||
field 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
|
||||
|
Loading…
Reference in New Issue
Block a user