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 wrap: on
line diff
--- a/.hgignore	Fri Jun 19 09:05:00 2009 +0200
+++ b/.hgignore	Wed Jun 24 11:21:20 2009 +0200
@@ -18,6 +18,7 @@
 
 # Trial output directory.
 _trial_temp
+dropin.cache
 
 # Benchmarking data.
 profile.data
--- a/doc/unit-testing.txt	Fri Jun 19 09:05:00 2009 +0200
+++ b/doc/unit-testing.txt	Wed Jun 24 11:21:20 2009 +0200
@@ -45,10 +45,10 @@
 If it fails with an ImportError, then please double-check that your
 ``PYTHONPATH`` is setup correctly.
 
-Now simply execute ``trial viff`` to run the unit tests. You should
-get output similar to this::
+Now simply execute ``trial --reactor viff viff`` to run the unit
+tests. You should get output similar to this::
 
-  % trial viff
+  % trial --reactor viff viff
   Seeding random generator with random seed 4658
   Running 65 tests.
   viff.test.test_active_runtime
@@ -149,6 +149,13 @@
 would be cluttered with long of traceback messages, making it
 difficult to notice new *unexpected* failures.
 
+.. warning::
+
+   Always run ``trial`` with the ``--reactor viff`` arguments. This
+   ensures that the tests are run with the special VIFF reactor. The
+   tests currently cannot be run without this reactor, but we might
+   lift this restriction in the future.
+
 
 Writing Unit Tests
 ------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/twisted/plugins/viff_reactor.py	Wed Jun 24 11:21:20 2009 +0200
@@ -0,0 +1,21 @@
+# Copyright 2009 VIFF Development Team.
+#
+# This file is part of VIFF, the Virtual Ideal Functionality Framework.
+#
+# VIFF is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License (LGPL) as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# VIFF is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+# Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with VIFF. If not, see <http://www.gnu.org/licenses/>.
+
+# This will register the VIFF reactor so that "trial --reactor viff"
+# can install it.
+from twisted.application.reactors import Reactor
+viff = Reactor('viff', 'viff.reactor', 'The re-entrent VIFF reactor.')
--- a/viff/test/__init__.py	Fri Jun 19 09:05:00 2009 +0200
+++ b/viff/test/__init__.py	Wed Jun 24 11:21:20 2009 +0200
@@ -1,4 +1,4 @@
-# Copyright 2007, 2008 VIFF Development Team.
+# Copyright 2007, 2008, 2009 VIFF Development Team.
 #
 # This file is part of VIFF, the Virtual Ideal Functionality Framework.
 #
@@ -14,6 +14,3 @@
 #
 # You should have received a copy of the GNU Lesser General Public
 # License along with VIFF. If not, see <http://www.gnu.org/licenses/>.
-
-import viff.reactor
-viff.reactor.install()