changeset 961:153c24a4a6c5

Randomize port numbers in unit tests.
author Martin Geisler <mg@daimi.au.dk>
date Thu, 02 Oct 2008 22:22:24 +0200
parents c1f4a7b57e75
children 37e05ffb25af
files viff/test/test_apps.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/viff/test/test_apps.py	Thu Oct 02 22:12:40 2008 +0200
+++ b/viff/test/test_apps.py	Thu Oct 02 22:22:24 2008 +0200
@@ -27,6 +27,7 @@
 from twisted.internet.defer import Deferred, gatherResults
 
 from viff.field import GF256
+from viff.util import rand
 
 def execute(executable, *args):
     """Execute *executable* when the reactor is started."""
@@ -53,9 +54,12 @@
         self.oldcwd = os.getcwd()
         os.chdir(path.join(root_dir, "apps"))
 
+        port1, port2, port3 = rand.sample(xrange(10000, 30000), 3)
         p = execute("generate-config-files.py", "--prefix", "trial",
                     "--players", "3", "--threshold", "1",
-                    "localhost:10000", "localhost:20000", "localhost:30000")
+                    "localhost:%d" % port1,
+                    "localhost:%d" % port2,
+                    "localhost:%d" % port3)
         return p
 
     def tearDown(self):