HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //usr/share/doc/python3-aiosmtpd/html/testing.html
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
  <meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Testing &mdash; aiosmtpd 1.4.4.post2 documentation</title>
      <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
      <link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=86f27845" />
      <link rel="stylesheet" type="text/css" href="_static/aiosmtpd.css?v=4cc6bf70" />

  
  
        <script src="_static/jquery.js?v=8dae8fb0"></script>
        <script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
        <script src="_static/documentation_options.js?v=ad49bbf5"></script>
        <script src="_static/doctools.js?v=888ff710"></script>
        <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="_static/js/theme.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="aiosmtpd" href="manpage.html" />
    <link rel="prev" title="Migrating from smtpd to aiosmtpd" href="migrating.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <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">
            aiosmtpd
          </a>
              <div class="version">
                1.4.4.post2
              </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" aria-label="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="Navigation menu">
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="intro.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="concepts.html">Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="cli.html">Command line usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="controller.html">Programmatic usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="smtp.html">The SMTP Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="lmtp.html">The LMTP class</a></li>
<li class="toctree-l1"><a class="reference internal" href="handlers.html">Handlers</a></li>
<li class="toctree-l1"><a class="reference internal" href="auth.html">Authentication System</a></li>
<li class="toctree-l1"><a class="reference internal" href="proxyprotocol.html">PROXY Protocol Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="migrating.html">Migrating from smtpd to aiosmtpd</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Testing</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#test-framework-pytest">Test Framework: <code class="docutils literal notranslate"><span class="pre">pytest</span></code></a><ul>
<li class="toctree-l3"><a class="reference internal" href="#plugins">Plugins</a></li>
<li class="toctree-l3"><a class="reference internal" href="#fixtures">Fixtures</a></li>
<li class="toctree-l3"><a class="reference internal" href="#markers">Markers</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#client_data"><code class="docutils literal notranslate"><span class="pre">client_data()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#controller_data"><code class="docutils literal notranslate"><span class="pre">controller_data()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#handler_data"><code class="docutils literal notranslate"><span class="pre">handler_data()</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="manpage.html">aiosmtpd</a></li>
<li class="toctree-l1"><a class="reference internal" href="NEWS.html">NEWS for aiosmtpd</a></li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">aiosmtpd</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
      <li class="breadcrumb-item active">Testing</li>
      <li class="wy-breadcrumbs-aside">
            <a href="_sources/testing.rst.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">
             
  <section id="testing">
<span id="id1"></span><h1>Testing<a class="headerlink" href="#testing" title="Link to this heading"></a></h1>
<p>Testing (which includes unit testing, integration testing, and regression testing)
is very important for quality code;
extremely so if the code is a library that will be used in other software.</p>
<section id="test-framework-pytest">
<h2>Test Framework: <code class="docutils literal notranslate"><span class="pre">pytest</span></code><a class="headerlink" href="#test-framework-pytest" title="Link to this heading"></a></h2>
<p><code class="docutils literal notranslate"><span class="pre">aiosmtpd</span></code> uses the <a class="reference external" href="https://docs.pytest.org/en/stable/contents.html"><code class="docutils literal notranslate"><span class="pre">pytest</span></code></a> testing framework.
Advanced features of pytest are widely used throughout.</p>
<section id="plugins">
<h3>Plugins<a class="headerlink" href="#plugins" title="Link to this heading"></a></h3>
<p>The one <strong>required</strong> plugin is <a class="reference external" href="https://pypi.org/project/pytest-mock/"><code class="docutils literal notranslate"><span class="pre">pytest-mock</span></code></a>;
it is used extensively throughout the test suite.</p>
<p>Other plugins that are used, to various degrees, in the <code class="docutils literal notranslate"><span class="pre">aiosmtpd</span></code> test suite are:</p>
<ul class="simple">
<li><p><a class="reference external" href="https://pypi.org/project/pytest-cov/"><code class="docutils literal notranslate"><span class="pre">pytest-cov</span></code></a> to integrate with <a class="reference external" href="https://pypi.org/project/coverage/"><code class="docutils literal notranslate"><span class="pre">coverage-py</span></code></a></p></li>
<li><p><a class="reference external" href="https://pypi.org/project/pytest-sugar/"><code class="docutils literal notranslate"><span class="pre">pytest-sugar</span></code></a> to provide better ux</p></li>
<li><p><a class="reference external" href="https://pypi.org/project/pytest-print/"><code class="docutils literal notranslate"><span class="pre">pytest-print</span></code></a> to give some progress indicator and to assist test troubleshooting</p></li>
<li><p><a class="reference external" href="https://pypi.org/project/pytest-profiling/"><code class="docutils literal notranslate"><span class="pre">pytest-profiling</span></code></a> to implement <code class="docutils literal notranslate"><span class="pre">*-profile</span></code> testenv,
although to be honest this is not really useful as the profiling gets ‘muddied’ by
pytest runner.</p></li>
</ul>
</section>
<section id="fixtures">
<h3>Fixtures<a class="headerlink" href="#fixtures" title="Link to this heading"></a></h3>
<p>Below is a list of fixtures defined throught the test suite,
in alphabetical order:</p>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>As long as you create your test module(s) inside the <code class="docutils literal notranslate"><span class="pre">aiosmtpd/tests</span></code> directory,
you do not need to import the above fixtures;
they will automatically be available for use as they are defined in the <code class="docutils literal notranslate"><span class="pre">conftest.py</span></code> file.</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Individual test modules may define their own module-specific fixtures;
please refer to their respective docstrings for description / usage guide.</p>
</div>
</section>
<section id="markers">
<h3>Markers<a class="headerlink" href="#markers" title="Link to this heading"></a></h3>
<dl class="py function">
<dt class="sig sig-object py" id="client_data">
<span class="sig-prename descclassname"><span class="pre">&#64;</span></span><span class="sig-name descname"><span class="pre">client_data</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">...</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#client_data" title="Link to this definition"></a></dt>
<dd><p>Provides parameters to the <a href="#id2"><span class="problematic" id="id3">:fixture:`~aiosmtpd.tests.conftest.client`</span></a> fixture.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>connect_to</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">HostPort</span></code>) – Address to connect to. Defaults to <code class="docutils literal notranslate"><span class="pre">Global.SrvAddr</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="controller_data">
<span class="sig-prename descclassname"><span class="pre">&#64;</span></span><span class="sig-name descname"><span class="pre">controller_data</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">...</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#controller_data" title="Link to this definition"></a></dt>
<dd><p>Provides parameters to the <a href="#id4"><span class="problematic" id="id5">:fixture:`~aiosmtpd.tests.conftest.get_controller`</span></a> fixture.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>class_</strong> – The class to be instantiated by <code class="docutils literal notranslate"><span class="pre">get_controller</span></code>.
Will be overridden if <code class="docutils literal notranslate"><span class="pre">get_controller</span></code> is invoked with
the <code class="docutils literal notranslate"><span class="pre">class_</span></code> argument.</p></li>
<li><p><strong>host_port</strong> (<em>str</em>) – The “host:port” to bound to</p></li>
<li><p><strong>**kwargs</strong> – Keyworded arguments given to the marker.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="handler_data">
<span class="sig-prename descclassname"><span class="pre">&#64;</span></span><span class="sig-name descname"><span class="pre">handler_data</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">...</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#handler_data" title="Link to this definition"></a></dt>
<dd><p>Provides parameters to the <a href="#id6"><span class="problematic" id="id7">:fixture:`~aiosmtpd.tests.conftest.get_handler`</span></a> fixture.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>args_</strong> – A tuple containing values that will be passed as positional arguments
to the controller constructor</p></li>
<li><p><strong>class_</strong> – The class to be instantiated by <code class="docutils literal notranslate"><span class="pre">get_controller</span></code></p></li>
<li><p><strong>*args</strong> – Positional arguments given to the marker.
Will override the <code class="docutils literal notranslate"><span class="pre">args_</span></code> keyword argument</p></li>
<li><p><strong>**kwargs</strong> – Keyworded arguments given to the marker.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</section>
</section>
</section>


           </div>
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="migrating.html" class="btn btn-neutral float-left" title="Migrating from smtpd to aiosmtpd" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="manpage.html" class="btn btn-neutral float-right" title="aiosmtpd" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2015-2024, The aiosmtpd Developers.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>