Skip to main content

Distributed tests planner plugin for pytest testing framework.

Project description

Distributed tests planner plugin for pytest testing framework

https://api.travis-ci.org/pytest-dev/pytest-cloud.png https://pypip.in/v/pytest-cloud/badge.png https://coveralls.io/repos/pytest-dev/pytest-cloud/badge.png?branch=master Documentation Status

Install pytest-cloud

pip install pytest-cloud

Features

The plugin provides an easy way of running tests amoung several test nodes (slaves). Uses the great pytest-xdist plugin for actual distributed run. When used, it will automatically detect capabilites of given node(s) and run only the number of test processes it is able to handle. If will also filter out offline nodes or nodes which were failed to respond to the capabilities acquisition call.

Supports automatic codebase propagation to the test nodes, so you don’t have to install python dependencies for your project on remote test nodes globally - just make sure that your virtualenv folder is inside your project folder - that’s a requirement. It will also detect a root folder of the test environment (project root), and will rsync it to all test nodes.

ATM only ssh transport is supported. So ensure that you have at least public key auth enabled to your test nodes from the master node (where py.test is executed).

Command-line options

  • –cloud-node

    Node hostname (or user@hostname) to run tests on. Multiple allowed.

  • –cloud-nodes

    Space-separated list of node hostname (or user@hostname) to run tests on. Multiple allowed.

  • –cloud-python

    Optional python executable name to be used on the remote test nodes. Default is the executable name used for the test run on the master.

  • –cloud-chdir

    Optional relative path to be used on the remote test nodes as target folder for syncing file and run tests. Default is pytest_<username>_<current_folder_name>.

  • –cloud-virtualenv-path

    Optional relative path to the virtualenv to be used on the remote test nodes. By default it will try to detect whether current test process is using virtualenv and if it’s located inside of the current directory. If that’s the case, it will use it for rsync on the remote node(s).

  • –cloud-mem-per-process

    Optional amount of memory roughly needed for test process, in megabytes. Will be used to calculate amount of test processes per node, getting the free memory, dividing it for the memory per process needed, and getting the minimum of that value and the number of CPU cores of the test node.

  • –cloud-max-processes

    Optional maximum number of processes per test node. Overrides from above the calculated number of processes using memory and number of CPU cores.

  • –cloud-rsync-bandwidth-limit

    Optional bandwidth limit per rsync process, in kilobytes per second. 5000 by default.

  • –cloud-rsync-max-processes

    Optional process count limit for rsync processes. By default there’s no limit so rsyncing will be in parallel for all test nodes.

Ini file options

  • cloud_develop_eggs

    Optional list of python package paths to install in development mode on remote side. Required to be inside of the project root directory.

Example

py.test tests/ --cloud-node=10.0.120.{1..40} --cloud-mem-per-process=1000 --rsyncdir=.

Or if you pass list of nodes as space-separated list:

py.test tests/ --cloud-nodes='10.0.120.1 10.0.120.2' --cloud-mem-per-process=1000 --rsyncdir=.

Contact

If you have questions, bug reports, suggestions, etc. please create an issue on the GitHub project page.

License

This software is licensed under the MIT license

See License file

© 2015 Anatoly Bubenkov and others.

Authors

Anatoly Bubenkov

original idea and implementation

Changelog

2.0.0

  • pytest fixed version number is removed from the requirements (olegpidsadnyi)

  • removed pytest-cache dependency (olegpidsadnyi)

1.3.8

  • Add verbosity to rsync progress (bubenkoff)

1.3.4

  • Add develop eggs setting to install packages on remote side in development mode (bubenkoff)

1.2.16

  • Correctly handle python path on remote side (bubenkoff)

1.2.12

  • Add rsync progress to the output, change default bandwidth limit (bubenkoff)

1.2.11

  • Fast native rsync instead of python based one (bubenkoff)

1.1.0

  • Avoid unnecessary multiple ssh connections to the same node (bubenkoff)

1.0.25

  • Correct virtualenv execution (bubenkoff)

1.0.18

  • Ensure plugin command line hook is executed first (bubenkoff)

  • Correct free memory calculation (bubenkoff)

1.0.15

  • Add pyc files cleanup (bubenkoff)

1.0.13

  • Automatic discovery of the virtualenv (bubenkoff)

  • Fixes to rsyncing (bubenkoff)

  • Safer node id generation (bubenkoff)

  • Guarantee uniqueness of provided nodes (bubenkoff)

1.0.10

  • Delete orphan files when rsyncing (bubenkoff)

1.0.7

  • Add possibility to pass node list as space separated (bubenkoff)

1.0.6

  • Initial public release

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-cloud-2.0.0.tar.gz (12.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page