newhooks.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. """
  2. xdist hooks.
  3. Additionally, pytest-xdist will also decorate a few other hooks
  4. with the worker instance that executed the hook originally:
  5. ``pytest_runtest_logreport``: ``rep`` parameter has a ``node`` attribute.
  6. You can use this hooks just as you would use normal pytest hooks, but some care
  7. must be taken in plugins in case ``xdist`` is not installed. Please see:
  8. http://pytest.org/en/latest/writing_plugins.html#optionally-using-hooks-from-3rd-party-plugins
  9. """
  10. import pytest
  11. def pytest_xdist_setupnodes(config, specs):
  12. """ called before any remote node is set up. """
  13. def pytest_xdist_newgateway(gateway):
  14. """ called on new raw gateway creation. """
  15. def pytest_xdist_rsyncstart(source, gateways):
  16. """ called before rsyncing a directory to remote gateways takes place. """
  17. def pytest_xdist_rsyncfinish(source, gateways):
  18. """ called after rsyncing a directory to remote gateways takes place. """
  19. def pytest_configure_node(node):
  20. """ configure node information before it gets instantiated. """
  21. def pytest_testnodeready(node):
  22. """ Test Node is ready to operate. """
  23. def pytest_testnodedown(node, error):
  24. """ Test Node is down. """
  25. def pytest_xdist_node_collection_finished(node, ids):
  26. """called by the master node when a node finishes collecting.
  27. """
  28. @pytest.mark.firstresult
  29. def pytest_xdist_make_scheduler(config, log):
  30. """ return a node scheduler implementation """