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()