Skip to content

Commit

Permalink
Deploying to gh-pages from @ 22e8ea9 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperCraeghs committed Jan 12, 2024
1 parent 541cb7a commit 5af0bbb
Show file tree
Hide file tree
Showing 23 changed files with 1,737 additions and 170 deletions.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: e6310c6f7edd4a2d73ae1de50b39ffab
config: 03aefcf2b2248b41b1603af1bb685e31
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified .doctrees/design.doctree
Binary file not shown.
Binary file modified .doctrees/environment.pickle
Binary file not shown.
12 changes: 8 additions & 4 deletions _modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Overview: module code &#8212; warning-plugin 4.4.0 documentation</title>
<title>Overview: module code &#8212; warning-plugin 5.0.0 documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css" />

Expand All @@ -30,7 +30,7 @@
<h3>Navigation</h3>
<ul>
<li class="responsive-menu"><a href="#sidebar-anchor" title="Navigation">&#9776;</a></li>
<li><a href="../index.html">warning-plugin-4.4.0</a> &#187;</li>
<li><a href="../index.html">warning-plugin-5.0.0</a> &#187;</li>
</ul>
</div>

Expand All @@ -47,7 +47,11 @@ <h3>Navigation</h3>
<div class="body" role="main">

<h1>All modules for which code is available</h1>
<ul><li><a href="mlx/warnings.html">mlx.warnings</a></li>
<ul><li><a href="mlx/warnings/junit_checker.html">mlx.warnings.junit_checker</a></li>
<li><a href="mlx/warnings/regex_checker.html">mlx.warnings.regex_checker</a></li>
<li><a href="mlx/warnings/robot_checker.html">mlx.warnings.robot_checker</a></li>
<li><a href="mlx/warnings/warnings.html">mlx.warnings.warnings</a></li>
<li><a href="mlx/warnings/warnings_checker.html">mlx.warnings.warnings_checker</a></li>
</ul>

<div class="clearer"></div>
Expand Down Expand Up @@ -105,7 +109,7 @@ <h3>Navigation</h3>

<div class="footer" role="contentinfo">
&#169; Copyright 2017-2019, Bavo Van Achte.
Last updated on Jan 02, 2024.
Last updated on Jan 12, 2024.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.3.0.
</div>
</body>
Expand Down
180 changes: 180 additions & 0 deletions _modules/mlx/warnings/junit_checker.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>mlx.warnings.junit_checker &#8212; warning-plugin 5.0.0 documentation</title>
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../../_static/pydoctheme.css" />

<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
<script src="../../../_static/jquery.js"></script>
<script src="../../../_static/underscore.js"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../../_static/doctools.js"></script>
<script src="../../../_static/sphinx_highlight.js"></script>

<script src="../../../_static/sidebar.js"></script>

<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<link rel="shortcut icon" type="image/png" href="../../../_static/favicon.png" />
<meta name="viewport" content="width=device-width,initial-scale=0.8">



</head><body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="responsive-menu"><a href="#sidebar-anchor" title="Navigation">&#9776;</a></li>
<li><a href="../../../index.html">warning-plugin-5.0.0</a> &#187;</li>
<li><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>

<div class="badge">
<a href="https://github.com/melexis/warnings-plugin">Fork me on GitHub</a>
<img src="../../../_static/[email protected]">
</div>



<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">

<h1>Source code for mlx.warnings.junit_checker</h1><div class="highlight"><pre>
<span></span><span class="k">try</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">lxml</span> <span class="kn">import</span> <span class="n">etree</span>
<span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">xml.etree</span> <span class="kn">import</span> <span class="n">ElementTree</span> <span class="k">as</span> <span class="n">etree</span>

<span class="kn">from</span> <span class="nn">junitparser</span> <span class="kn">import</span> <span class="n">Error</span><span class="p">,</span> <span class="n">Failure</span><span class="p">,</span> <span class="n">JUnitXml</span>

<span class="kn">from</span> <span class="nn">.warnings_checker</span> <span class="kn">import</span> <span class="n">WarningsChecker</span>


<div class="viewcode-block" id="JUnitChecker"><a class="viewcode-back" href="../../../design.html#mlx.warnings.JUnitChecker">[docs]</a><span class="k">class</span> <span class="nc">JUnitChecker</span><span class="p">(</span><span class="n">WarningsChecker</span><span class="p">):</span>
<span class="n">name</span> <span class="o">=</span> <span class="s1">&#39;junit&#39;</span>

<div class="viewcode-block" id="JUnitChecker.check"><a class="viewcode-back" href="../../../design.html#mlx.warnings.JUnitChecker.check">[docs]</a> <span class="k">def</span> <span class="nf">check</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">content</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&#39;&#39;&#39; Function for counting the number of JUnit failures in a specific text</span>

<span class="sd"> Args:</span>
<span class="sd"> content (str): The content to parse</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">root_input</span> <span class="o">=</span> <span class="n">etree</span><span class="o">.</span><span class="n">fromstring</span><span class="p">(</span><span class="n">content</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s1">&#39;utf-8&#39;</span><span class="p">))</span>
<span class="n">testsuites_root</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepare_tree</span><span class="p">(</span><span class="n">root_input</span><span class="p">)</span>
<span class="n">suites</span> <span class="o">=</span> <span class="n">JUnitXml</span><span class="o">.</span><span class="n">fromelem</span><span class="p">(</span><span class="n">testsuites_root</span><span class="p">)</span>
<span class="n">amount_to_exclude</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">for</span> <span class="n">suite</span> <span class="ow">in</span> <span class="n">suites</span><span class="p">:</span>
<span class="k">for</span> <span class="n">testcase</span> <span class="ow">in</span> <span class="n">suite</span><span class="p">:</span>
<span class="n">amount_to_exclude</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_testcase</span><span class="p">(</span><span class="n">testcase</span><span class="p">)</span>
<span class="n">suites</span><span class="o">.</span><span class="n">update_statistics</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">count</span> <span class="o">+=</span> <span class="n">suites</span><span class="o">.</span><span class="n">failures</span> <span class="o">+</span> <span class="n">suites</span><span class="o">.</span><span class="n">errors</span> <span class="o">-</span> <span class="n">amount_to_exclude</span>
<span class="k">except</span> <span class="n">etree</span><span class="o">.</span><span class="n">ParseError</span> <span class="k">as</span> <span class="n">err</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="n">err</span><span class="p">)</span></div>

<div class="viewcode-block" id="JUnitChecker.prepare_tree"><a class="viewcode-back" href="../../../design.html#mlx.warnings.JUnitChecker.prepare_tree">[docs]</a> <span class="nd">@staticmethod</span>
<span class="k">def</span> <span class="nf">prepare_tree</span><span class="p">(</span><span class="n">root_input</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&#39;&#39;&#39; Prepares the tree element by adding a testsuites element as root when missing (to please JUnitXml)</span>

<span class="sd"> Args:</span>
<span class="sd"> root_input (lxml.etree._Element/xml.etree.ElementTree.Element): Top-level XML element from input file</span>

<span class="sd"> Returns:</span>
<span class="sd"> lxml.etree._Element/xml.etree.ElementTree.Element: Top-level XML element with testsuites tag</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="k">if</span> <span class="n">root_input</span><span class="o">.</span><span class="n">tag</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s1">&#39;testsuite&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="n">root_input</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s1">&#39;testcase&#39;</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">testsuites_root</span> <span class="o">=</span> <span class="n">root_input</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">testsuites_root</span> <span class="o">=</span> <span class="n">etree</span><span class="o">.</span><span class="n">Element</span><span class="p">(</span><span class="s2">&quot;testsuites&quot;</span><span class="p">)</span>
<span class="n">testsuites_root</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">root_input</span><span class="p">)</span>
<span class="k">return</span> <span class="n">testsuites_root</span></div>

<span class="k">def</span> <span class="nf">_check_testcase</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">testcase</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot; Handles the check of a test case element by checking if the result is a failure/error.</span>

<span class="sd"> If it is to be excluded by a configured regex, 1 is returned.</span>
<span class="sd"> Otherwise, when in verbose mode, the suite name and test case name are printed.</span>

<span class="sd"> Args:</span>
<span class="sd"> testcase (junitparser.TestCase): Test case element to check for failure or error</span>

<span class="sd"> Returns:</span>
<span class="sd"> int: 1 if a failure/error is to be subtracted from the final count, 0 otherwise</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">testcase</span><span class="o">.</span><span class="n">result</span><span class="p">,</span> <span class="p">(</span><span class="n">Failure</span><span class="p">,</span> <span class="n">Error</span><span class="p">)):</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_excluded</span><span class="p">(</span><span class="n">testcase</span><span class="o">.</span><span class="n">result</span><span class="o">.</span><span class="n">message</span><span class="p">):</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="n">string</span> <span class="o">=</span> <span class="s1">&#39;</span><span class="si">{classname}</span><span class="s1">.</span><span class="si">{testname}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">classname</span><span class="o">=</span><span class="n">testcase</span><span class="o">.</span><span class="n">classname</span><span class="p">,</span> <span class="n">testname</span><span class="o">=</span><span class="n">testcase</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">counted_warnings</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s1">&#39;</span><span class="si">{}</span><span class="s1">: </span><span class="si">{}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">string</span><span class="p">,</span> <span class="n">testcase</span><span class="o">.</span><span class="n">result</span><span class="o">.</span><span class="n">message</span><span class="p">))</span>
<span class="bp">self</span><span class="o">.</span><span class="n">print_when_verbose</span><span class="p">(</span><span class="n">string</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">0</span></div>
</pre></div>

<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<a id="sidebar-anchor"></a>


<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script><h3><a href="../../../index.html">Table Of Contents</a></h3>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../readme.html">Command Line Warnings Plugin</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../readme.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../readme.html#usage">Usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../readme.html#issues-and-new-features">Issues and New Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../readme.html#contribute">Contribute</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../installation.html">Installation Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../design.html">Software Design</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contributing.html">Contribution Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contributing.html#getting-started">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contributing.html#reporting-issues-or-requesting-a-new-feature">Reporting Issues or Requesting a New Feature</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../authors.html">Authors</a></li>
</ul>

</div>
<div id="sidebarbutton" title="Collapse sidebar">
<span>«</span>
</div>

</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
</ul>
</div>

<div class="footer" role="contentinfo">
&#169; Copyright 2017-2019, Bavo Van Achte.
Last updated on Jan 12, 2024.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.3.0.
</div>
</body>
</html>
Loading

0 comments on commit 5af0bbb

Please sign in to comment.