From f7cbfcffec47721c16d90cafd28cbc0fe6c563d2 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Sun, 25 May 2008 03:13:41 +0000 Subject: [PATCH] Use test_support to get network ports to bind to. --- Lib/bsddb/test/test_replication.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Lib/bsddb/test/test_replication.py b/Lib/bsddb/test/test_replication.py index e4f626affad..693e0670065 100644 --- a/Lib/bsddb/test/test_replication.py +++ b/Lib/bsddb/test/test_replication.py @@ -2,6 +2,7 @@ """ import os +import time import unittest try: @@ -57,10 +58,12 @@ class DBReplicationManager(unittest.TestCase): self.dbenvMaster.set_event_notify(confirmed_master) self.dbenvClient.set_event_notify(client_startupdone) - self.dbenvMaster.repmgr_set_local_site("127.0.0.1",46117) - self.dbenvClient.repmgr_set_local_site("127.0.0.1",46118) - self.dbenvMaster.repmgr_add_remote_site("127.0.0.1",46118) - self.dbenvClient.repmgr_add_remote_site("127.0.0.1",46117) + master_port = test_support.find_unused_port() + self.dbenvMaster.repmgr_set_local_site("127.0.0.1", master_port) + client_port = test_support.find_unused_port() + self.dbenvClient.repmgr_set_local_site("127.0.0.1", client_port) + self.dbenvMaster.repmgr_add_remote_site("127.0.0.1", client_port) + self.dbenvClient.repmgr_add_remote_site("127.0.0.1", master_port) self.dbenvMaster.rep_set_nsites(2) self.dbenvClient.rep_set_nsites(2) self.dbenvMaster.rep_set_priority(10) @@ -91,10 +94,9 @@ class DBReplicationManager(unittest.TestCase): # The timeout is necessary in BDB 4.5, since DB_EVENT_REP_STARTUPDONE # is not generated if the master has no new transactions. # This is solved in BDB 4.6 (#15542). - import time timeout = time.time()+2 while (time.time()= (4,6) : self.assertTrue(time.time()