You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qubes-installer-qubes-os/anaconda/docs/html/tests/tests.lib.html

350 lines
14 KiB

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>tests.lib package &mdash; Anaconda 25.14 documentation</title>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="top" title="Anaconda 25.14 documentation" href="../index.html"/>
<link rel="up" title="tests package" href="tests.html"/>
<link rel="next" title="tests.pyanaconda_tests package" href="tests.pyanaconda_tests.html"/>
<link rel="prev" title="tests.gui package" href="tests.gui.html"/>
<script src="../_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="../index.html" class="icon icon-home"> Anaconda
</a>
<div class="version">
25.14
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../intro.html">Introduction to Anaconda</a></li>
<li class="toctree-l1"><a class="reference internal" href="../release.html">Building a Release</a></li>
<li class="toctree-l1"><a class="reference internal" href="../boot-options.html">Anaconda Boot Options</a></li>
<li class="toctree-l1"><a class="reference internal" href="../kickstart.html">Anaconda Kickstart Documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../commit-log.html">Rules for commit messages</a></li>
<li class="toctree-l1"><a class="reference internal" href="../driverdisc.html">Brief description of DriverDisc version 3</a></li>
<li class="toctree-l1"><a class="reference internal" href="../iscsi.html">iSCSI and Anaconda</a></li>
<li class="toctree-l1"><a class="reference internal" href="../multipath.html">Multipath and Anaconda</a></li>
<li class="toctree-l1"><a class="reference internal" href="../modules.html">pyanaconda</a></li>
<li class="toctree-l1"><a class="reference internal" href="../testing.html">Testing</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="modules.html">tests</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="tests.html">tests package</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="tests.html#subpackages">Subpackages</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="tests.dd_tests.html">tests.dd_tests package</a></li>
<li class="toctree-l4"><a class="reference internal" href="tests.dracut_tests.html">tests.dracut_tests package</a></li>
<li class="toctree-l4"><a class="reference internal" href="tests.gettext_tests.html">tests.gettext_tests package</a></li>
<li class="toctree-l4"><a class="reference internal" href="tests.glade.html">tests.glade package</a></li>
<li class="toctree-l4"><a class="reference internal" href="tests.gui.html">tests.gui package</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="">tests.lib package</a></li>
<li class="toctree-l4"><a class="reference internal" href="tests.pyanaconda_tests.html">tests.pyanaconda_tests package</a></li>
<li class="toctree-l4"><a class="reference internal" href="tests.regex_tests.html">tests.regex_tests package</a></li>
<li class="toctree-l4"><a class="reference internal" href="tests.storage.html">tests.storage package</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="tests.html#submodules">Submodules</a></li>
<li class="toctree-l3"><a class="reference internal" href="tests.html#module-tests.usercustomize">tests.usercustomize module</a></li>
<li class="toctree-l3"><a class="reference internal" href="tests.html#module-tests">Module contents</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">Anaconda</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html">Docs</a> &raquo;</li>
<li><a href="modules.html">tests</a> &raquo;</li>
<li><a href="tests.html">tests package</a> &raquo;</li>
<li>tests.lib package</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/tests/tests.lib.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="tests-lib-package">
<h1>tests.lib package<a class="headerlink" href="#tests-lib-package" title="Permalink to this headline"></a></h1>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-tests.lib.filelist">
<span id="tests-lib-filelist-module"></span><h2>tests.lib.filelist module<a class="headerlink" href="#module-tests.lib.filelist" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="tests.lib.filelist.testfilelist">
<code class="descclassname">tests.lib.filelist.</code><code class="descname">testfilelist</code><span class="sig-paren">(</span><em>filterfunc=None</em><span class="sig-paren">)</span><a class="headerlink" href="#tests.lib.filelist.testfilelist" title="Permalink to this definition"></a></dt>
<dd><p>A generator function for the list of file names to check.</p>
<p>If the check is run from a git work tree, the method returns a list
of files known to git. Otherwise, it returns a list of every file
beneath $top_srcdir.</p>
<p>top_srcdir must be set in the environment.</p>
<p>filterfunc, if provided, is a function that takes a filename as an
argument and returns True for files that should be included in the
file list. For example, something like lambda x: fnmatch(x, &#8216;<a href="#id1"><span class="problematic" id="id2">*</span></a>.py&#8217;)
could be used to match only filenames that end in .py.</p>
</dd></dl>
</div>
<div class="section" id="tests-lib-gladecheck-module">
<h2>tests.lib.gladecheck module<a class="headerlink" href="#tests-lib-gladecheck-module" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-tests.lib.iconcheck">
<span id="tests-lib-iconcheck-module"></span><h2>tests.lib.iconcheck module<a class="headerlink" href="#module-tests.lib.iconcheck" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="tests.lib.iconcheck.icon_exists">
<code class="descclassname">tests.lib.iconcheck.</code><code class="descname">icon_exists</code><span class="sig-paren">(</span><em>icon_name</em><span class="sig-paren">)</span><a class="headerlink" href="#tests.lib.iconcheck.icon_exists" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
<div class="section" id="module-tests.lib.regexcheck">
<span id="tests-lib-regexcheck-module"></span><h2>tests.lib.regexcheck module<a class="headerlink" href="#module-tests.lib.regexcheck" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="tests.lib.regexcheck.regex_group">
<code class="descclassname">tests.lib.regexcheck.</code><code class="descname">regex_group</code><span class="sig-paren">(</span><em>expression</em>, <em>test_cases</em><span class="sig-paren">)</span><a class="headerlink" href="#tests.lib.regexcheck.regex_group" title="Permalink to this definition"></a></dt>
<dd><p>Check that a regex parses strings into expected groups.</p>
<p>Test cases is a list of tuples of the form (test_string, expected_result)
where expected_result is the groups tuples that should be returned by
regex.match.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>expression</strong> &#8211; a compiled expression object</li>
<li><strong>test_cases</strong> &#8211; a list of test strings and expected results</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">True if all test cases return the expected groups</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.5)">bool</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="tests.lib.regexcheck.regex_match">
<code class="descclassname">tests.lib.regexcheck.</code><code class="descname">regex_match</code><span class="sig-paren">(</span><em>expression</em>, <em>goodlist</em>, <em>badlist</em><span class="sig-paren">)</span><a class="headerlink" href="#tests.lib.regexcheck.regex_match" title="Permalink to this definition"></a></dt>
<dd><p>Check that a regular expression matches and does not match lists of strings.</p>
<p>This method will print a message for any failure and return a a bool
to indicate whether the testcase passed.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>expression</strong> &#8211; a compiled regular expression object</li>
<li><strong>goodlist</strong> &#8211; a list of strings expected to be matched by expression</li>
<li><strong>badlist</strong> &#8211; a list of strings expected not to be matched by expression</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">True if all strings in the lists matched or did not match as expected</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.5)">bool</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-tests.lib.shutup">
<span id="tests-lib-shutup-module"></span><h2>tests.lib.shutup module<a class="headerlink" href="#module-tests.lib.shutup" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="tests.lib.shutup.shutup">
<code class="descclassname">tests.lib.shutup.</code><code class="descname">shutup</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tests.lib.shutup.shutup" title="Permalink to this definition"></a></dt>
<dd><p>Run something with stdout and stderr redirected to /dev/null</p>
<p>The redirections will be process-wide, so this is not recommended
for multithreaded applications.</p>
</dd></dl>
</div>
<div class="section" id="module-tests.lib.timer">
<span id="tests-lib-timer-module"></span><h2>tests.lib.timer module<a class="headerlink" href="#module-tests.lib.timer" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="tests.lib.timer.timer">
<code class="descclassname">tests.lib.timer.</code><code class="descname">timer</code><span class="sig-paren">(</span><em>seconds</em><span class="sig-paren">)</span><a class="headerlink" href="#tests.lib.timer.timer" title="Permalink to this definition"></a></dt>
<dd><p>Return a timer context manager.</p>
<p>If the code within the context does not finish within the given number
of seconds, it will raise an AssertionError.</p>
</dd></dl>
</div>
<div class="section" id="module-tests.lib">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-tests.lib" title="Permalink to this headline"></a></h2>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="tests.pyanaconda_tests.html" class="btn btn-neutral float-right" title="tests.pyanaconda_tests package" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="tests.gui.html" class="btn btn-neutral" title="tests.gui package" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2015, Red Hat, Inc..
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../',
VERSION:'25.14',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>