viff

changeset 1193:ef0499add96c

Make the VIFF reactor available to trial.
author Martin Geisler <mg@cs.au.dk>
date Wed, 24 Jun 2009 11:21:20 +0200
parents c1259ceebc55
children 51167e387cc3
files .hgignore doc/unit-testing.txt twisted/plugins/viff_reactor.py viff/test/__init__.py
diffstat 4 files changed, 33 insertions(+), 7 deletions(-) [+]
line diff
     1.1 --- a/.hgignore	Fri Jun 19 09:05:00 2009 +0200
     1.2 +++ b/.hgignore	Wed Jun 24 11:21:20 2009 +0200
     1.3 @@ -18,6 +18,7 @@
     1.4  
     1.5  # Trial output directory.
     1.6  _trial_temp
     1.7 +dropin.cache
     1.8  
     1.9  # Benchmarking data.
    1.10  profile.data
     2.1 --- a/doc/unit-testing.txt	Fri Jun 19 09:05:00 2009 +0200
     2.2 +++ b/doc/unit-testing.txt	Wed Jun 24 11:21:20 2009 +0200
     2.3 @@ -45,10 +45,10 @@
     2.4  If it fails with an ImportError, then please double-check that your
     2.5  ``PYTHONPATH`` is setup correctly.
     2.6  
     2.7 -Now simply execute ``trial viff`` to run the unit tests. You should
     2.8 -get output similar to this::
     2.9 +Now simply execute ``trial --reactor viff viff`` to run the unit
    2.10 +tests. You should get output similar to this::
    2.11  
    2.12 -  % trial viff
    2.13 +  % trial --reactor viff viff
    2.14    Seeding random generator with random seed 4658
    2.15    Running 65 tests.
    2.16    viff.test.test_active_runtime
    2.17 @@ -149,6 +149,13 @@
    2.18  would be cluttered with long of traceback messages, making it
    2.19  difficult to notice new *unexpected* failures.
    2.20  
    2.21 +.. warning::
    2.22 +
    2.23 +   Always run ``trial`` with the ``--reactor viff`` arguments. This
    2.24 +   ensures that the tests are run with the special VIFF reactor. The
    2.25 +   tests currently cannot be run without this reactor, but we might
    2.26 +   lift this restriction in the future.
    2.27 +
    2.28  
    2.29  Writing Unit Tests
    2.30  ------------------
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/twisted/plugins/viff_reactor.py	Wed Jun 24 11:21:20 2009 +0200
     3.3 @@ -0,0 +1,21 @@
     3.4 +# Copyright 2009 VIFF Development Team.
     3.5 +#
     3.6 +# This file is part of VIFF, the Virtual Ideal Functionality Framework.
     3.7 +#
     3.8 +# VIFF is free software: you can redistribute it and/or modify it
     3.9 +# under the terms of the GNU Lesser General Public License (LGPL) as
    3.10 +# published by the Free Software Foundation, either version 3 of the
    3.11 +# License, or (at your option) any later version.
    3.12 +#
    3.13 +# VIFF is distributed in the hope that it will be useful, but WITHOUT
    3.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    3.15 +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
    3.16 +# Public License for more details.
    3.17 +#
    3.18 +# You should have received a copy of the GNU Lesser General Public
    3.19 +# License along with VIFF. If not, see <http://www.gnu.org/licenses/>.
    3.20 +
    3.21 +# This will register the VIFF reactor so that "trial --reactor viff"
    3.22 +# can install it.
    3.23 +from twisted.application.reactors import Reactor
    3.24 +viff = Reactor('viff', 'viff.reactor', 'The re-entrent VIFF reactor.')
     4.1 --- a/viff/test/__init__.py	Fri Jun 19 09:05:00 2009 +0200
     4.2 +++ b/viff/test/__init__.py	Wed Jun 24 11:21:20 2009 +0200
     4.3 @@ -1,4 +1,4 @@
     4.4 -# Copyright 2007, 2008 VIFF Development Team.
     4.5 +# Copyright 2007, 2008, 2009 VIFF Development Team.
     4.6  #
     4.7  # This file is part of VIFF, the Virtual Ideal Functionality Framework.
     4.8  #
     4.9 @@ -14,6 +14,3 @@
    4.10  #
    4.11  # You should have received a copy of the GNU Lesser General Public
    4.12  # License along with VIFF. If not, see <http://www.gnu.org/licenses/>.
    4.13 -
    4.14 -import viff.reactor
    4.15 -viff.reactor.install()