{"id":41523,"date":"2023-12-01T05:38:31","date_gmt":"2023-12-01T05:38:31","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=41523"},"modified":"2023-12-01T05:38:33","modified_gmt":"2023-12-01T05:38:33","slug":"python-test-runners-pytest-xdist","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/python-test-runners-pytest-xdist\/","title":{"rendered":"Python Test Runners &#8211; Pytest-xdist"},"content":{"rendered":"\n<p>Below is a sample code demonstrating how Pytest-xdist can be used to run tests concurrently on multiple CPU cores, which can significantly reduce test execution time for large test suites.<\/p>\n\n\n\n<p>To run the tests in parallel using Pytest-xdist, you can specify the number of CPUs to use with the&nbsp;<code>-n<\/code>&nbsp;option. For example, to run tests on 2 CPUs in parallel, you can run:<\/p>\n\n\n\n<p>Pytest-xdist will execute the test cases concurrently, utilizing the available CPU cores efficiently.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/devops-school\/dc94ac7919972cabe5e10f612ec5a6a2.js\"><\/script>\n","protected":false},"excerpt":{"rendered":"<p>Below is a sample code demonstrating how Pytest-xdist can be used to run tests concurrently on multiple CPU cores, which can significantly reduce test execution time for&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-41523","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/41523","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=41523"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/41523\/revisions"}],"predecessor-version":[{"id":41524,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/41523\/revisions\/41524"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=41523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=41523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=41523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}