D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
usr
/
share
/
doc
/
python-zope-event-4.0.3
/
html
/
Filename :
hacking.html
back
Copy
<!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="Content-Type" content="text/html; charset=utf-8" /> <title>Hacking on zope.event — zope.event 4.0.3 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '', VERSION: '4.0.3', 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> <link rel="top" title="zope.event 4.0.3 documentation" href="index.html" /> <link rel="prev" title="zope.event API Reference" href="api.html" /> </head> <body> <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="api.html" title="zope.event API Reference" accesskey="P">previous</a> |</li> <li><a href="index.html">zope.event 4.0.3 documentation</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="hacking-on-zope-event"> <h1>Hacking on <tt class="xref py py-mod docutils literal"><span class="pre">zope.event</span></tt><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 <tt class="xref py py-mod docutils literal"><span class="pre">zope.event</span></tt> is in the Zope Subversion repository:</p> <p><a class="reference external" href="http://svn.zope.org/zope.event">http://svn.zope.org/zope.event</a></p> <p>You can get a read-only Subversion checkout from there:</p> <div class="highlight-sh"><div class="highlight"><pre><span class="nv">$ </span>svn checkout svn://svn.zope.org/repos/main/zope.event/trunk zope.event </pre></div> </div> <p>The project also mirrors the trunk from the Subversion 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"><div class="highlight"><pre><span class="nv">$ </span>bzr branch lp:zope.event </pre></div> </div> </div> <div class="section" id="running-the-tests-in-a-virtualenv"> <h2>Running the tests in a <tt class="docutils literal"><span class="pre">virtualenv</span></tt><a class="headerlink" href="#running-the-tests-in-a-virtualenv" title="Permalink to this headline">¶</a></h2> <p>If you use the <tt class="docutils literal"><span class="pre">virtualenv</span></tt> package to create lightweight Python development environments, you can run the tests using nothing more than the <tt class="docutils literal"><span class="pre">python</span></tt> binary in a virtualenv. First, create a scratch environment:</p> <div class="highlight-sh"><div class="highlight"><pre><span class="nv">$ </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"><div class="highlight"><pre><span class="nv">$ </span>/tmp/hack-zope.event/bin/python setup.py develop </pre></div> </div> <p>Finally, run the tests using the build-in <tt class="docutils literal"><span class="pre">setuptools</span></tt> testrunner:</p> <div class="highlight-sh"><div class="highlight"><pre><span class="nv">$ </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 2 tests in 0.000s OK </pre></div> </div> <p>If you have the <tt class="xref py py-mod docutils literal"><span class="pre">nose</span></tt> package installed in the virtualenv, you can use its testrunner too:</p> <div class="highlight-sh"><div class="highlight"><pre><span class="nv">$ </span>/tmp/hack-zope.event/bin/easy_install nose ... <span class="nv">$ </span>/tmp/hack-zope.event/bin/python setup.py nosetests running nosetests ... ---------------------------------------------------------------------- Ran 3 tests in 0.011s OK </pre></div> </div> <p>or:</p> <div class="highlight-sh"><div class="highlight"><pre><span class="nv">$ </span>/tmp/hack-zope.event/bin/nosetests ... ---------------------------------------------------------------------- Ran 3 tests in 0.011s OK </pre></div> </div> <p>If you have the <tt class="xref py py-mod docutils literal"><span class="pre">coverage</span></tt> pacakge installed in the virtualenv, you can see how well the tests cover the code:</p> <div class="highlight-sh"><div class="highlight"><pre><span class="nv">$ </span>/tmp/hack-zope.event/bin/easy_install nose coverage ... <span class="nv">$ </span>/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 5 5 100% ---------------------------------------------------------------------- Ran 3 tests in 0.019s OK </pre></div> </div> </div> <div class="section" id="building-the-documentation-in-a-virtualenv"> <h2>Building the documentation in a <tt class="docutils literal"><span class="pre">virtualenv</span></tt><a class="headerlink" href="#building-the-documentation-in-a-virtualenv" title="Permalink to this headline">¶</a></h2> <p><tt class="xref py py-mod docutils literal"><span class="pre">zope.event</span></tt> uses the nifty <tt class="xref py py-mod docutils literal"><span class="pre">Sphinx</span></tt> 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"><div class="highlight"><pre><span class="nv">$ </span>/tmp/hack-zope.event/bin/easy_install Sphinx ... <span class="nv">$ </span><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"><div class="highlight"><pre><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 --------------- 1 items passed all tests: 17 tests in default 17 tests in 1 items. 17 passed and 0 failed. Test passed. Doctest <span class="nv">summary</span> <span class="o">===============</span> 17 tests 0 failures in tests 0 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 class="section" id="running-the-tests-using-zc-buildout"> <h2>Running the tests using <tt class="xref py py-mod docutils literal"><span class="pre">zc.buildout</span></tt><a class="headerlink" href="#running-the-tests-using-zc-buildout" title="Permalink to this headline">¶</a></h2> <p><tt class="xref py py-mod docutils literal"><span class="pre">zope.event</span></tt> ships with its own <tt class="file docutils literal"><span class="pre">buildout.cfg</span></tt> file and <tt class="file docutils literal"><span class="pre">bootstrap.py</span></tt> for setting up a development buildout:</p> <div class="highlight-sh"><div class="highlight"><pre><span class="nv">$ </span>/path/to/python2.6 bootstrap.py ... Generated script <span class="s1">'.../bin/buildout'</span> <span class="nv">$ </span>bin/buildout Develop: <span class="s1">'/home/tseaver/projects/Zope/BTK/event/.'</span> ... Generated script <span class="s1">'.../bin/sphinx-quickstart'</span>. Generated script <span class="s1">'.../bin/sphinx-build'</span>. </pre></div> </div> <p>You can now run the tests:</p> <div class="highlight-sh"><div class="highlight"><pre><span class="nv">$ </span>bin/test --all Running zope.testing.testrunner.layer.UnitTests tests: Set up zope.testing.testrunner.layer.UnitTests in 0.000 seconds. Ran 2 tests with 0 failures and 0 errors in 0.000 seconds. Tearing down left over layers: Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds. </pre></div> </div> </div> <div class="section" id="building-the-documentation-using-zc-buildout"> <h2>Building the documentation using <tt class="xref py py-mod docutils literal"><span class="pre">zc.buildout</span></tt><a class="headerlink" href="#building-the-documentation-using-zc-buildout" title="Permalink to this headline">¶</a></h2> <p>The <tt class="xref py py-mod docutils literal"><span class="pre">zope.event</span></tt> buildout installs the Sphinx scripts required to build the documentation, including testing its code snippets:</p> <div class="highlight-sh"><div class="highlight"><pre><span class="nv">$ </span><span class="nb">cd </span>docs <span class="nv">$ PATH</span><span class="o">=</span>../bin:<span class="nv">$PATH</span> make doctest html .../bin/sphinx-build -b doctest -d .../docs/_build/doctrees .../docs .../docs/_build/doctest running tests... Document: index --------------- 1 items passed all tests: 17 tests in default 17 tests in 1 items. 17 passed and 0 failed. Test passed. Doctest <span class="nv">summary</span> <span class="o">===============</span> 17 tests 0 failures in tests 0 failures in setup code build succeeded. Testing of doctests in the sources finished, look at the results in .../docs/_build/doctest/output.txt. .../bin/sphinx-build -b html -d .../docs/_build/doctrees .../docs .../docs/_build/html ... build succeeded. Build finished. The HTML pages are in .../docs/_build/html. </pre></div> </div> </div> <div class="section" id="running-tests-on-multiple-python-versions-via-tox"> <h2>Running Tests on Multiple Python Versions via <tt class="xref py py-mod docutils literal"><span class="pre">tox</span></tt><a class="headerlink" href="#running-tests-on-multiple-python-versions-via-tox" title="Permalink to this headline">¶</a></h2> <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 <tt class="docutils literal"><span class="pre">virtualenv</span></tt> for each configured version, installs the current package and configured dependencies into each <tt class="docutils literal"><span class="pre">virtualenv</span></tt>, and then runs the configured commands.</p> <p><tt class="xref py py-mod docutils literal"><span class="pre">zope.event</span></tt> configures the following <tt class="xref py py-mod docutils literal"><span class="pre">tox</span></tt> environments via its <tt class="docutils literal"><span class="pre">tox.ini</span></tt> file:</p> <ul class="simple"> <li>The <tt class="docutils literal"><span class="pre">py26</span></tt> environment builds a <tt class="docutils literal"><span class="pre">virtualenv</span></tt> with <tt class="docutils literal"><span class="pre">python2.6</span></tt>, installs <tt class="xref py py-mod docutils literal"><span class="pre">zope.event</span></tt>, and runs the tests via <tt class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">test</span> <span class="pre">-q</span></tt>.</li> <li>The <tt class="docutils literal"><span class="pre">py27</span></tt> environment builds a <tt class="docutils literal"><span class="pre">virtualenv</span></tt> with <tt class="docutils literal"><span class="pre">python2.7</span></tt>, installs <tt class="xref py py-mod docutils literal"><span class="pre">zope.event</span></tt>, and runs the tests via <tt class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">test</span> <span class="pre">-q</span></tt>.</li> <li>The <tt class="docutils literal"><span class="pre">py32</span></tt> environment builds a <tt class="docutils literal"><span class="pre">virtualenv</span></tt> with <tt class="docutils literal"><span class="pre">python3.2</span></tt>, installs <tt class="xref py py-mod docutils literal"><span class="pre">zope.event</span></tt> and dependencies, and runs the tests via <tt class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">test</span> <span class="pre">-q</span></tt>.</li> <li>The <tt class="docutils literal"><span class="pre">pypy</span></tt> environment builds a <tt class="docutils literal"><span class="pre">virtualenv</span></tt> with <tt class="docutils literal"><span class="pre">pypy</span></tt>, installs <tt class="xref py py-mod docutils literal"><span class="pre">zope.event</span></tt>, and runs the tests via <tt class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">test</span> <span class="pre">-q</span></tt>.</li> <li>The <tt class="docutils literal"><span class="pre">coverage</span></tt> environment builds a <tt class="docutils literal"><span class="pre">virtualenv</span></tt> with <tt class="docutils literal"><span class="pre">python2.6</span></tt>, installs <tt class="xref py py-mod docutils literal"><span class="pre">zope.event</span></tt>, installs <tt class="xref py py-mod docutils literal"><span class="pre">nose</span></tt> and <tt class="xref py py-mod docutils literal"><span class="pre">coverage</span></tt>, and runs <tt class="docutils literal"><span class="pre">nosetests</span></tt> with statement coverage.</li> <li>The <tt class="docutils literal"><span class="pre">docs</span></tt> environment builds a virtualenv with <tt class="docutils literal"><span class="pre">python2.6</span></tt>, installs <tt class="xref py py-mod docutils literal"><span class="pre">zope.event</span></tt>, installs <tt class="docutils literal"><span class="pre">Sphinx</span></tt> and dependencies, and then builds the docs and exercises the doctest snippets.</li> </ul> <p>This example requires that you have a working <tt class="docutils literal"><span class="pre">python2.6</span></tt> on your path, as well as installing <tt class="docutils literal"><span class="pre">tox</span></tt>:</p> <div class="highlight-sh"><div class="highlight"><pre><span class="nv">$ </span>tox -e py26 GLOB sdist-make: .../zope.interface/setup.py py26 sdist-reinst: .../zope.interface/.tox/dist/zope.interface-4.0.2dev.zip py26 runtests: commands<span class="o">[</span>0<span class="o">]</span> ... ---------------------------------------------------------------------- Ran 2 tests in 0.000s OK ___________________________________ summary ____________________________________ py26: commands succeeded congratulations :<span class="o">)</span> </pre></div> </div> <p>Running <tt class="docutils literal"><span class="pre">tox</span></tt> with no arguments runs all the configured environments, including building the docs and testing their snippets:</p> <div class="highlight-sh"><div class="highlight"><pre><span class="nv">$ </span>tox GLOB sdist-make: .../zope.interface/setup.py py26 sdist-reinst: .../zope.interface/.tox/dist/zope.interface-4.0.2dev.zip py26 runtests: commands<span class="o">[</span>0<span class="o">]</span> ... Doctest <span class="nv">summary</span> <span class="o">===============</span> 17 tests 0 failures in tests 0 failures in setup code 0 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 class="section" id="submitting-a-bug-report"> <h2>Submitting a Bug Report<a class="headerlink" href="#submitting-a-bug-report" title="Permalink to this headline">¶</a></h2> <p><tt class="xref py py-mod docutils literal"><span class="pre">zope.event</span></tt> tracks its bugs on Launchpad:</p> <p><a class="reference external" href="https://bugs.launchpad.net/zope.event">https://bugs.launchpad.net/zope.event</a></p> <p>Please submit bug reports and feature requests there.</p> </div> <div class="section" id="sharing-your-changes"> <h2>Sharing Your Changes<a class="headerlink" href="#sharing-your-changes" title="Permalink to this headline">¶</a></h2> <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 you got a read-only checkout from the Subversion repository, and you have made a change you would like to share, the best route is to let Subversion help you make a patch file:</p> <div class="highlight-sh"><div class="highlight"><pre><span class="nv">$ </span>svn diff > zope.event-cool_feature.patch </pre></div> </div> <p>You can then upload that patch file as an attachment to a Launchpad bug report.</p> <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"><div class="highlight"><pre><span class="nv">$ </span>bzr push lp:~tseaver/zope.event/cool_feature </pre></div> </div> <p>After pushing your branch, you can link it to a bug report on Launchpad, or request that the maintainers merge your branch using the Launchpad “merge request” feature.</p> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Hacking on <tt class="docutils literal"><span class="pre">zope.event</span></tt></a><ul> <li><a class="reference internal" href="#getting-the-code">Getting the Code</a></li> <li><a class="reference internal" href="#running-the-tests-in-a-virtualenv">Running the tests in a <tt class="docutils literal"><span class="pre">virtualenv</span></tt></a></li> <li><a class="reference internal" href="#building-the-documentation-in-a-virtualenv">Building the documentation in a <tt class="docutils literal"><span class="pre">virtualenv</span></tt></a></li> <li><a class="reference internal" href="#running-the-tests-using-zc-buildout">Running the tests using <tt class="docutils literal"><span class="pre">zc.buildout</span></tt></a></li> <li><a class="reference internal" href="#building-the-documentation-using-zc-buildout">Building the documentation using <tt class="docutils literal"><span class="pre">zc.buildout</span></tt></a></li> <li><a class="reference internal" href="#running-tests-on-multiple-python-versions-via-tox">Running Tests on Multiple Python Versions via <tt class="docutils literal"><span class="pre">tox</span></tt></a></li> <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> <h4>Previous topic</h4> <p class="topless"><a href="api.html" title="previous chapter"><tt class="docutils literal"><span class="pre">zope.event</span></tt> API Reference</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/hacking.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <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> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </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" >index</a></li> <li class="right" > <a href="api.html" title="zope.event API Reference" >previous</a> |</li> <li><a href="index.html">zope.event 4.0.3 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2010, Zope Foundation and Contributors. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> </body> </html>
Name
Size
Last Modified
Owner
Permissions
Actions
_sources
Dir
February 10 2022 8:31:22
root
0755
_static
Dir
February 10 2022 8:31:22
root
0755
api.html
5.655
KB
October 15 2014 1:44:09
root
0644
genindex.html
3.272
KB
October 15 2014 1:44:10
root
0644
hacking.html
21.583
KB
October 15 2014 1:44:09
root
0644
index.html
7.047
KB
October 15 2014 1:44:10
root
0644
objects.inv
0.253
KB
October 15 2014 1:44:10
root
0644
search.html
3.065
KB
October 15 2014 1:44:10
root
0644
searchindex.js
3.618
KB
October 15 2014 1:44:10
root
0644
theory.html
4.904
KB
October 15 2014 1:44:10
root
0644
usage.html
9.955
KB
October 15 2014 1:44:10
root
0644
2017 © D7net | D704T team