code: def rsync(self, gateway, source, notify=None, verbose=False, ignores=None):
          
          # XXX This changes the calling behaviour of
          #     pytest_xdist_rsyncstart and pytest_xdist_rsyncfinish to
          #     be called once per rsync target.
          rsync = HostRSync(source, verbose=verbose, ignores=ignores)
          spec = gateway.spec
          if spec.popen and not spec.chdir:
              # XXX This assumes that sources are python-packages
              #     and that adding the basedir does not hurt.
              gateway.remote_exec(
                  """
                  import sys ; sys.path.insert(0, %r)
              """
                  % os.path.dirname(str(source))
              ).waitclose()
              return
          if (spec, source) in self._rsynced_specs:
              return
  
          def finished():
              if notify:
                  notify("rsyncrootready", spec, source)
  
          rsync.add_target_host(gateway, finished=finished)
          self._rsynced_specs.add((spec, source))
          self.config.hook.pytest_xdist_rsyncstart(source=source, gateways=[gateway])
          rsync.send()
          self.config.hook.pytest_xdist_rsyncfinish(source=source, gateways=[gateway])
docs: Perform rsync to remote hosts for node.