def test_link_race_condition():
  context1 = Context()
  context1.start()

  context2 = Context()
  context2.start()

  class Leader(Process):
    def __init__(self):
      super(Leader, self).__init__('leader')
      self.uuid = None

    @Process.install('register')
    def register(self, from_pid, uuid):
      log.debug((from_pid, uuid) % 'Leader::register(%s, %s)')
      self.send(from_pid, 'registered', uuid)

  class Follower(Process):
    def __init__(self, leader):
      super(Follower, self).__init__('follower')
      self.leader = leader
      self.uuid = uuid.uuid4().bytes
      self.registered = threading.Event()

    def initialize(self):
      super(Follower, self).initialize()
      self.link(self.leader.pid)
      self.send(self.leader.pid, 'register', self.uuid)

    @Process.install('registered')
    def registered(self, from_pid, uuid):
      log.debug('Follower::registered(%s, %s)' % (from_pid, uuid))
      assert uuid == self.uuid
      assert from_pid == self.leader.pid
      self.registered.set()

  leader = Leader()
  context1.spawn(leader)

  follower = Follower(leader)
  context2.spawn(follower)

  follower.registered.wait(timeout=MAX_TIMEOUT)
  assert follower.registered.is_set()

  context1.stop()
  context2.stop()
dataset/ETHPy150Open wickman/compactor/tests/test_process.py/test_link_race_condition/swapped operands of `%`