Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run a single test with multiple configs in parallel using pytest

I have to run the same test against different hosts in parallel. Currently, i'm making a bunchof pytest.main() calls. But this is not run in parallel and results are not aggregated. This is the content of runtest.py:

pytest.main('--conf=c1.txt')
pytest.main('--conf=c2.txt')
pytest.main('--conf=c3.txt')

I have just one test_host.py which looks something like:

test_pinghost(conf):
    # pings a host in config

Is there a way to run this in parallel and aggregate results? PS:the config filejust contains the host IP

like image 506
semantic_c0d3r Avatar asked Apr 09 '26 22:04

semantic_c0d3r


1 Answers

Please use http://pytest.readthedocs.org/en/2.0.3/xdist.html, it enables pytest to run tests across multiple processes/machines

like image 61
Anatoly Bubenkov Avatar answered Apr 11 '26 12:04

Anatoly Bubenkov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!