Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > aac008a726c21673c6c59aa2e521b8cb > files > 59

python-zope-event-4.3.0-3.mga7.noarch.rpm


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Hacking on zope.event &#8212; zope.event 4.3.0 documentation</title>
    <link rel="stylesheet" href="_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></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/language_data.js"></script>
    
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="prev" title="Class-based event handlers" href="classhandler.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <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>
        <li class="right" >
          <a href="classhandler.html" title="Class-based event handlers"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">zope.event 4.3.0 documentation</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="hacking-on-zope-event">
<h1>Hacking on <a class="reference internal" href="usage.html#module-zope.event" title="zope.event"><code class="xref py py-mod docutils literal notranslate"><span class="pre">zope.event</span></code></a><a class="headerlink" href="#hacking-on-zope-event" title="Permalink to this headline">¶</a></h1>
<div class="section" id="getting-the-code">
<h2>Getting the Code<a class="headerlink" href="#getting-the-code" title="Permalink to this headline">¶</a></h2>
<p>The main repository for <a class="reference internal" href="usage.html#module-zope.event" title="zope.event"><code class="xref py py-mod docutils literal notranslate"><span class="pre">zope.event</span></code></a> is in the Zope Foundation
Github repository:</p>
<blockquote>
<div><a class="reference external" href="https://github.com/zopefoundation/zope.event">https://github.com/zopefoundation/zope.event</a></div></blockquote>
<p>You can get a read-only checkout from there:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ git clone https://github.com/zopefoundation/zope.event.git
</pre></div>
</div>
<p>or fork it and get a writeable checkout of your fork:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ git clone git@github.com/jrandom/zope.event.git
</pre></div>
</div>
<p>The project also mirrors the trunk from the Github repository as a
Bazaar branch on Launchpad:</p>
<p><a class="reference external" href="https://code.launchpad.net/zope.event">https://code.launchpad.net/zope.event</a></p>
<p>You can branch the trunk from there using Bazaar:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ bzr branch lp:zope.event
</pre></div>
</div>
</div>
<div class="section" id="working-in-a-virtualenv">
<h2>Working in a <code class="docutils literal notranslate"><span class="pre">virtualenv</span></code><a class="headerlink" href="#working-in-a-virtualenv" title="Permalink to this headline">¶</a></h2>
<div class="section" id="installing">
<h3>Installing<a class="headerlink" href="#installing" title="Permalink to this headline">¶</a></h3>
<p>If you use the <code class="docutils literal notranslate"><span class="pre">virtualenv</span></code> package to create lightweight Python
development environments, you can run the tests using nothing more
than the <code class="docutils literal notranslate"><span class="pre">python</span></code> binary in a virtualenv.  First, create a scratch
environment:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ /path/to/virtualenv --no-site-packages /tmp/hack-zope.event
</pre></div>
</div>
<p>Next, get this package registered as a “development egg” in the
environment:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ /tmp/hack-zope.event/bin/python setup.py develop
</pre></div>
</div>
</div>
<div class="section" id="running-the-tests">
<h3>Running the tests<a class="headerlink" href="#running-the-tests" title="Permalink to this headline">¶</a></h3>
<p>Then, you canrun the tests using the build-in <code class="docutils literal notranslate"><span class="pre">setuptools</span></code> testrunner:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ /tmp/hack-zope.event/bin/python setup.py <span class="nb">test</span>
running <span class="nb">test</span>
...
test_empty <span class="o">(</span>zope.event.tests.Test_notify<span class="o">)</span> ... ok
test_not_empty <span class="o">(</span>zope.event.tests.Test_notify<span class="o">)</span> ... ok

----------------------------------------------------------------------
Ran <span class="m">2</span> tests in <span class="m">0</span>.000s

OK
</pre></div>
</div>
<p>If you have the <code class="xref py py-mod docutils literal notranslate"><span class="pre">nose</span></code> package installed in the virtualenv, you can
use its testrunner too:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ /tmp/hack-zope.event/bin/easy_install nose
...
$ /tmp/hack-zope.event/bin/python setup.py nosetests
running nosetests
...
----------------------------------------------------------------------
Ran <span class="m">3</span> tests in <span class="m">0</span>.011s

OK
</pre></div>
</div>
<p>or:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ /tmp/hack-zope.event/bin/nosetests
...
----------------------------------------------------------------------
Ran <span class="m">3</span> tests in <span class="m">0</span>.011s

OK
</pre></div>
</div>
<p>If you have the <code class="xref py py-mod docutils literal notranslate"><span class="pre">coverage</span></code> pacakge installed in the virtualenv,
you can see how well the tests cover the code:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ /tmp/hack-zope.event/bin/easy_install nose coverage
...
$ /tmp/hack-zope.event/bin/python setup.py nosetests <span class="se">\</span>
    --with coverage --cover-package<span class="o">=</span>zope.event
running nosetests
...
Name         Stmts   Exec  Cover   Missing
------------------------------------------
zope.event       <span class="m">5</span>      <span class="m">5</span>   <span class="m">100</span>%
----------------------------------------------------------------------
Ran <span class="m">3</span> tests in <span class="m">0</span>.019s

OK
</pre></div>
</div>
</div>
<div class="section" id="building-the-documentation">
<h3>Building the documentation<a class="headerlink" href="#building-the-documentation" title="Permalink to this headline">¶</a></h3>
<p><a class="reference internal" href="usage.html#module-zope.event" title="zope.event"><code class="xref py py-mod docutils literal notranslate"><span class="pre">zope.event</span></code></a> uses the nifty <code class="xref py py-mod docutils literal notranslate"><span class="pre">Sphinx</span></code> documentation system
for building its docs.  Using the same virtualenv you set up to run the
tests, you can build the docs:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ /tmp/hack-zope.event/bin/easy_install Sphinx
...
$ <span class="nb">cd</span> docs
$ <span class="nv">PATH</span><span class="o">=</span>/tmp/hack-zope.event/bin:<span class="nv">$PATH</span> make html
sphinx-build -b html -d _build/doctrees   . _build/html
...
build succeeded.

Build finished. The HTML pages are in _build/html.
</pre></div>
</div>
<p>You can also test the code snippets in the documentation:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ <span class="nv">PATH</span><span class="o">=</span>/tmp/hack-zope.event/bin:<span class="nv">$PATH</span> make doctest
sphinx-build -b doctest -d _build/doctrees   . _build/doctest
...
running tests...

Document: index
---------------
<span class="m">1</span> items passed all tests:
  <span class="m">17</span> tests in default
<span class="m">17</span> tests in <span class="m">1</span> items.
<span class="m">17</span> passed and <span class="m">0</span> failed.
Test passed.

Doctest <span class="nv">summary</span>
<span class="o">===============</span>
   <span class="m">17</span> tests
    <span class="m">0</span> failures in tests
    <span class="m">0</span> failures in setup code
build succeeded.
Testing of doctests in the sources finished, look at the  <span class="se">\</span>
    results in _build/doctest/output.txt.
</pre></div>
</div>
</div>
</div>
<div class="section" id="using-zc-buildout">
<h2>Using <code class="xref py py-mod docutils literal notranslate"><span class="pre">zc.buildout</span></code><a class="headerlink" href="#using-zc-buildout" title="Permalink to this headline">¶</a></h2>
<div class="section" id="setting-up-the-buildout">
<h3>Setting up the buildout<a class="headerlink" href="#setting-up-the-buildout" title="Permalink to this headline">¶</a></h3>
<p><a class="reference internal" href="usage.html#module-zope.event" title="zope.event"><code class="xref py py-mod docutils literal notranslate"><span class="pre">zope.event</span></code></a> ships with its own <code class="file docutils literal notranslate"><span class="pre">buildout.cfg</span></code> file and
<code class="file docutils literal notranslate"><span class="pre">bootstrap.py</span></code> for setting up a development buildout:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ /path/to/python2.6 bootstrap.py
...
Generated script <span class="s1">&#39;.../bin/buildout&#39;</span>
$ bin/buildout
Develop: <span class="s1">&#39;/home/jrandom/projects/Zope/zope.event/.&#39;</span>
...
Generated script <span class="s1">&#39;.../bin/sphinx-quickstart&#39;</span>.
Generated script <span class="s1">&#39;.../bin/sphinx-build&#39;</span>.
</pre></div>
</div>
</div>
<div class="section" id="id1">
<h3>Running the tests<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h3>
<p>You can now run the tests:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ bin/test --all
Running zope.testing.testrunner.layer.UnitTests tests:
  Set up zope.testing.testrunner.layer.UnitTests in <span class="m">0</span>.000 seconds.
  Ran <span class="m">2</span> tests with <span class="m">0</span> failures and <span class="m">0</span> errors in <span class="m">0</span>.000 seconds.
Tearing down left over layers:
  Tear down zope.testing.testrunner.layer.UnitTests in <span class="m">0</span>.000 seconds.
</pre></div>
</div>
</div>
</div>
<div class="section" id="using-tox">
<h2>Using <code class="xref py py-mod docutils literal notranslate"><span class="pre">tox</span></code><a class="headerlink" href="#using-tox" title="Permalink to this headline">¶</a></h2>
<div class="section" id="running-tests-on-multiple-python-versions">
<h3>Running Tests on Multiple Python Versions<a class="headerlink" href="#running-tests-on-multiple-python-versions" title="Permalink to this headline">¶</a></h3>
<p><a class="reference external" href="http://tox.testrun.org/latest/">tox</a> is a Python-based test automation
tool designed to run tests against multiple Python versions.  It creates
a <code class="docutils literal notranslate"><span class="pre">virtualenv</span></code> for each configured version, installs the current package
and configured dependencies into each <code class="docutils literal notranslate"><span class="pre">virtualenv</span></code>, and then runs the
configured commands.</p>
<p><a class="reference internal" href="usage.html#module-zope.event" title="zope.event"><code class="xref py py-mod docutils literal notranslate"><span class="pre">zope.event</span></code></a> configures the following <code class="xref py py-mod docutils literal notranslate"><span class="pre">tox</span></code> environments via
its <code class="docutils literal notranslate"><span class="pre">tox.ini</span></code> file:</p>
<ul class="simple">
<li>The <code class="docutils literal notranslate"><span class="pre">py26</span></code>, <code class="docutils literal notranslate"><span class="pre">py27</span></code>, <code class="docutils literal notranslate"><span class="pre">py33</span></code>, <code class="docutils literal notranslate"><span class="pre">py34</span></code>, and <code class="docutils literal notranslate"><span class="pre">pypy</span></code> environments
builds a <code class="docutils literal notranslate"><span class="pre">virtualenv</span></code> with the corresponding interpreter,
installs <a class="reference internal" href="usage.html#module-zope.event" title="zope.event"><code class="xref py py-mod docutils literal notranslate"><span class="pre">zope.event</span></code></a> and dependencies, and runs the tests
via <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">-q</span> <span class="pre">test</span> <span class="pre">-q</span></code>.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">coverage</span></code> environment builds a <code class="docutils literal notranslate"><span class="pre">virtualenv</span></code> with <code class="docutils literal notranslate"><span class="pre">python2.6</span></code>,
installs <a class="reference internal" href="usage.html#module-zope.event" title="zope.event"><code class="xref py py-mod docutils literal notranslate"><span class="pre">zope.event</span></code></a>, installs
<code class="xref py py-mod docutils literal notranslate"><span class="pre">nose</span></code> and <code class="xref py py-mod docutils literal notranslate"><span class="pre">coverage</span></code>, and runs <code class="docutils literal notranslate"><span class="pre">nosetests</span></code> with statement
and branch coverage.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">docs</span></code> environment builds a virtualenv with <code class="docutils literal notranslate"><span class="pre">python2.6</span></code>, installs
<a class="reference internal" href="usage.html#module-zope.event" title="zope.event"><code class="xref py py-mod docutils literal notranslate"><span class="pre">zope.event</span></code></a>, installs <code class="docutils literal notranslate"><span class="pre">Sphinx</span></code> and
dependencies, and then builds the docs and exercises the doctest snippets.</li>
</ul>
<p>This example requires that you have a working <code class="docutils literal notranslate"><span class="pre">python2.6</span></code> on your path,
as well as installing <code class="docutils literal notranslate"><span class="pre">tox</span></code>:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ tox -e py26
GLOB sdist-make: .../zope.event/setup.py
py26 sdist-reinst: .../zope.event/.tox/dist/zope.event-4.0.2dev.zip
py26 runtests: commands<span class="o">[</span><span class="m">0</span><span class="o">]</span>
...
----------------------------------------------------------------------
Ran <span class="m">2</span> tests in <span class="m">0</span>.000s

OK
___________________________________ summary ____________________________________
py26: commands succeeded
congratulations :<span class="o">)</span>
</pre></div>
</div>
<p>Running <code class="docutils literal notranslate"><span class="pre">tox</span></code> with no arguments runs all the configured environments,
including building the docs and testing their snippets:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ tox
GLOB sdist-make: .../zope.event/setup.py
py26 sdist-reinst: .../zope.event/.tox/dist/zope.event-4.0.2dev.zip
py26 runtests: commands<span class="o">[</span><span class="m">0</span><span class="o">]</span>
...
Doctest <span class="nv">summary</span>
<span class="o">===============</span>
 <span class="m">17</span> tests
   <span class="m">0</span> failures in tests
   <span class="m">0</span> failures in setup code
   <span class="m">0</span> failures in cleanup code
build succeeded.
___________________________________ summary ____________________________________
py26: commands succeeded
py27: commands succeeded
py32: commands succeeded
pypy: commands succeeded
coverage: commands succeeded
docs: commands succeeded
congratulations :<span class="o">)</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="contributing-to-zope-event">
<h2>Contributing to <a class="reference internal" href="usage.html#module-zope.event" title="zope.event"><code class="xref py py-mod docutils literal notranslate"><span class="pre">zope.event</span></code></a><a class="headerlink" href="#contributing-to-zope-event" title="Permalink to this headline">¶</a></h2>
<div class="section" id="submitting-a-bug-report">
<h3>Submitting a Bug Report<a class="headerlink" href="#submitting-a-bug-report" title="Permalink to this headline">¶</a></h3>
<p><a class="reference internal" href="usage.html#module-zope.event" title="zope.event"><code class="xref py py-mod docutils literal notranslate"><span class="pre">zope.event</span></code></a> tracks its bugs on Github:</p>
<blockquote>
<div><a class="reference external" href="https://github.com/zopefoundation/zope.event/issues">https://github.com/zopefoundation/zope.event/issues</a></div></blockquote>
<p>Please submit bug reports and feature requests there.</p>
</div>
<div class="section" id="sharing-your-changes">
<h3>Sharing Your Changes<a class="headerlink" href="#sharing-your-changes" title="Permalink to this headline">¶</a></h3>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Please ensure that all tests are passing before you submit your code.
If possible, your submission should include new tests for new features
or bug fixes, although it is possible that you may have tested your
new code by updating existing tests.</p>
</div>
<p>If have made a change you would like to share, the best route is to fork
the Githb repository, check out your fork, make your changes on a branch
in your fork, and push it.  You can then submit a pull request from your
branch:</p>
<blockquote>
<div><a class="reference external" href="https://github.com/zopefoundation/zope.event/pulls">https://github.com/zopefoundation/zope.event/pulls</a></div></blockquote>
<p>If you branched the code from Launchpad using Bazaar, you have another
option:  you can “push” your branch to Launchpad:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ bzr push lp:~jrandom/zope.event/cool_feature
</pre></div>
</div>
<p>After pushing your branch, you can link it to a bug report on Github,
or request that the maintainers merge your branch using the Launchpad
“merge request” feature.</p>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Hacking on <code class="docutils literal notranslate"><span class="pre">zope.event</span></code></a><ul>
<li><a class="reference internal" href="#getting-the-code">Getting the Code</a></li>
<li><a class="reference internal" href="#working-in-a-virtualenv">Working in a <code class="docutils literal notranslate"><span class="pre">virtualenv</span></code></a><ul>
<li><a class="reference internal" href="#installing">Installing</a></li>
<li><a class="reference internal" href="#running-the-tests">Running the tests</a></li>
<li><a class="reference internal" href="#building-the-documentation">Building the documentation</a></li>
</ul>
</li>
<li><a class="reference internal" href="#using-zc-buildout">Using <code class="docutils literal notranslate"><span class="pre">zc.buildout</span></code></a><ul>
<li><a class="reference internal" href="#setting-up-the-buildout">Setting up the buildout</a></li>
<li><a class="reference internal" href="#id1">Running the tests</a></li>
</ul>
</li>
<li><a class="reference internal" href="#using-tox">Using <code class="docutils literal notranslate"><span class="pre">tox</span></code></a><ul>
<li><a class="reference internal" href="#running-tests-on-multiple-python-versions">Running Tests on Multiple Python Versions</a></li>
</ul>
</li>
<li><a class="reference internal" href="#contributing-to-zope-event">Contributing to <code class="docutils literal notranslate"><span class="pre">zope.event</span></code></a><ul>
<li><a class="reference internal" href="#submitting-a-bug-report">Submitting a Bug Report</a></li>
<li><a class="reference internal" href="#sharing-your-changes">Sharing Your Changes</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="classhandler.html"
                        title="previous chapter">Class-based event handlers</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/hacking.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="classhandler.html" title="Class-based event handlers"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">zope.event 4.3.0 documentation</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2010, Zope Foundation and Contributors.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.3.
    </div>
  </body>
</html>