{"id":12753,"date":"2019-03-21T11:53:13","date_gmt":"2019-03-21T18:53:13","guid":{"rendered":"https:\/\/engineering.fb.com\/?p=12753"},"modified":"2020-03-23T15:35:47","modified_gmt":"2020-03-23T22:35:47","slug":"python-test-runner","status":"publish","type":"post","link":"https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/","title":{"rendered":"Open-sourcing Python Test Runner for multiple tests in parallel"},"content":{"rendered":"<h2>WHAT&#8217;S NEW:<\/h2>\n<p>A new Python-based project called Python Test Runner (<code>ptr<\/code>), that allows developers to run Python unit test suites. The main difference between <code>ptr<\/code> and existing test runners is that <code>ptr<\/code> crawls a repository to find Python projects with unit tests defined in their setup files. It then runs each suite in parallel with configured enabled steps.<\/p>\n<h2>WHY IT MATTERS:<\/h2>\n<p>The <code>ptr<\/code> project was created as a way to provide a lightweight tool using standard open source Python components. Supported and tested on Linux, MacOS, and Windows, <code>ptr<\/code> allows developers to test multiple projects in one Python environment and run the tests in parallel.<\/p>\n<p>To achieve this, <code>ptr<\/code> recursively searches for <code>setup.(cfg|py)<\/code> from <code>BASE_DIR<\/code> (-b) and parses the found setup files for <code>ptr<\/code> configuration. If <code>setup.(cfg|py)<\/code> exists with <code>ptr<\/code> configuration, <code>ptr<\/code> runs the tests. When running test suites in parallel, all steps will be run for each suite until failure, and only failed runs will have their output written to <code>stdout<\/code>.<\/p>\n<h2>USE IT FOR:<\/h2>\n<p><code>ptr<\/code> has four main use cases:<\/p>\n<ul>\n<li>Running a Python test suite<\/li>\n<li>Optionally checking and enforcing code coverage requirements<\/li>\n<li>Optionally formatting and linting Python code<\/li>\n<li>Optionally performing static type analysis<\/li>\n<\/ul>\n<h2><b>GET IT ON GITHUB:<\/b><\/h2>\n<p><a href=\"https:\/\/github.com\/facebookincubator\/ptr\">ptr on github<\/a><br \/>\n<a href=\"https:\/\/pypi.org\/project\/ptr\/\">ptr on PyPI<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>WHAT&#8217;S NEW: A new Python-based project called Python Test Runner (ptr), that allows developers to run Python unit test suites. The main difference between ptr and existing test runners is that ptr crawls a repository to find Python projects with unit tests defined in their setup files. It then runs each suite in parallel with [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":12754,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[66,174],"tags":[194],"coauthors":[1989,385],"class_list":["post-12753","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developer-tools","category-open-source","tag-open-source-in-brief","fb_content_type-article"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v19.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Python Test Runner: Open sourced for parallel tests - Engineering at Meta<\/title>\n<meta name=\"description\" content=\"Python Test Runner (ptr) allows developers to run Python unit test suites in parallel by crawling a repository to find projects with defined unit tests.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Cooper Lees, changigi649\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/2019\\\/03\\\/21\\\/open-source\\\/python-test-runner\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/2019\\\/03\\\/21\\\/open-source\\\/python-test-runner\\\/\"},\"author\":{\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/2019\\\/03\\\/21\\\/open-source\\\/python-test-runner\\\/#author\",\"name\":\"Cooper Lees\"},\"headline\":\"Open-sourcing Python Test Runner for multiple tests in parallel\",\"datePublished\":\"2019-03-21T18:53:13+00:00\",\"dateModified\":\"2020-03-23T22:35:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/2019\\\/03\\\/21\\\/open-source\\\/python-test-runner\\\/\"},\"wordCount\":200,\"publisher\":{\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/2019\\\/03\\\/21\\\/open-source\\\/python-test-runner\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/engineering.fb.com\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/OSIBBlue1.jpg\",\"keywords\":[\"Open Source in Brief\"],\"articleSection\":[\"DevInfra\",\"Open Source\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/2019\\\/03\\\/21\\\/open-source\\\/python-test-runner\\\/\",\"url\":\"https:\\\/\\\/engineering.fb.com\\\/2019\\\/03\\\/21\\\/open-source\\\/python-test-runner\\\/\",\"name\":\"Python Test Runner: Open sourced for parallel tests - Engineering at Meta\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/2019\\\/03\\\/21\\\/open-source\\\/python-test-runner\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/2019\\\/03\\\/21\\\/open-source\\\/python-test-runner\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/engineering.fb.com\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/OSIBBlue1.jpg\",\"datePublished\":\"2019-03-21T18:53:13+00:00\",\"dateModified\":\"2020-03-23T22:35:47+00:00\",\"description\":\"Python Test Runner (ptr) allows developers to run Python unit test suites in parallel by crawling a repository to find projects with defined unit tests.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/2019\\\/03\\\/21\\\/open-source\\\/python-test-runner\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/engineering.fb.com\\\/2019\\\/03\\\/21\\\/open-source\\\/python-test-runner\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/2019\\\/03\\\/21\\\/open-source\\\/python-test-runner\\\/#primaryimage\",\"url\":\"https:\\\/\\\/engineering.fb.com\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/OSIBBlue1.jpg\",\"contentUrl\":\"https:\\\/\\\/engineering.fb.com\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/OSIBBlue1.jpg\",\"width\":2000,\"height\":1125,\"caption\":\"Releasing Pythia to simplify building vision and language multimodal AI models\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/2019\\\/03\\\/21\\\/open-source\\\/python-test-runner\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/engineering.fb.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Open-sourcing Python Test Runner for multiple tests in parallel\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/#website\",\"url\":\"https:\\\/\\\/engineering.fb.com\\\/\",\"name\":\"Engineering at Meta\",\"description\":\"Engineering at Meta Blog\",\"publisher\":{\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/engineering.fb.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/#organization\",\"name\":\"Meta\",\"url\":\"https:\\\/\\\/engineering.fb.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/engineering.fb.com\\\/wp-content\\\/uploads\\\/2023\\\/08\\\/Meta_lockup_positive-primary_RGB.jpg\",\"contentUrl\":\"https:\\\/\\\/engineering.fb.com\\\/wp-content\\\/uploads\\\/2023\\\/08\\\/Meta_lockup_positive-primary_RGB.jpg\",\"width\":29011,\"height\":12501,\"caption\":\"Meta\"},\"image\":{\"@id\":\"https:\\\/\\\/engineering.fb.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Engineering\\\/\",\"https:\\\/\\\/x.com\\\/fb_engineering\"]},[]]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python Test Runner: Open sourced for parallel tests - Engineering at Meta","description":"Python Test Runner (ptr) allows developers to run Python unit test suites in parallel by crawling a repository to find projects with defined unit tests.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/","twitter_misc":{"Written by":"Cooper Lees, changigi649","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/#article","isPartOf":{"@id":"https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/"},"author":{"@id":"https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/#author","name":"Cooper Lees"},"headline":"Open-sourcing Python Test Runner for multiple tests in parallel","datePublished":"2019-03-21T18:53:13+00:00","dateModified":"2020-03-23T22:35:47+00:00","mainEntityOfPage":{"@id":"https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/"},"wordCount":200,"publisher":{"@id":"https:\/\/engineering.fb.com\/#organization"},"image":{"@id":"https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/#primaryimage"},"thumbnailUrl":"https:\/\/engineering.fb.com\/wp-content\/uploads\/2019\/03\/OSIBBlue1.jpg","keywords":["Open Source in Brief"],"articleSection":["DevInfra","Open Source"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/","url":"https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/","name":"Python Test Runner: Open sourced for parallel tests - Engineering at Meta","isPartOf":{"@id":"https:\/\/engineering.fb.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/#primaryimage"},"image":{"@id":"https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/#primaryimage"},"thumbnailUrl":"https:\/\/engineering.fb.com\/wp-content\/uploads\/2019\/03\/OSIBBlue1.jpg","datePublished":"2019-03-21T18:53:13+00:00","dateModified":"2020-03-23T22:35:47+00:00","description":"Python Test Runner (ptr) allows developers to run Python unit test suites in parallel by crawling a repository to find projects with defined unit tests.","breadcrumb":{"@id":"https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/#primaryimage","url":"https:\/\/engineering.fb.com\/wp-content\/uploads\/2019\/03\/OSIBBlue1.jpg","contentUrl":"https:\/\/engineering.fb.com\/wp-content\/uploads\/2019\/03\/OSIBBlue1.jpg","width":2000,"height":1125,"caption":"Releasing Pythia to simplify building vision and language multimodal AI models"},{"@type":"BreadcrumbList","@id":"https:\/\/engineering.fb.com\/2019\/03\/21\/open-source\/python-test-runner\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/engineering.fb.com\/"},{"@type":"ListItem","position":2,"name":"Open-sourcing Python Test Runner for multiple tests in parallel"}]},{"@type":"WebSite","@id":"https:\/\/engineering.fb.com\/#website","url":"https:\/\/engineering.fb.com\/","name":"Engineering at Meta","description":"Engineering at Meta Blog","publisher":{"@id":"https:\/\/engineering.fb.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/engineering.fb.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/engineering.fb.com\/#organization","name":"Meta","url":"https:\/\/engineering.fb.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/engineering.fb.com\/#\/schema\/logo\/image\/","url":"https:\/\/engineering.fb.com\/wp-content\/uploads\/2023\/08\/Meta_lockup_positive-primary_RGB.jpg","contentUrl":"https:\/\/engineering.fb.com\/wp-content\/uploads\/2023\/08\/Meta_lockup_positive-primary_RGB.jpg","width":29011,"height":12501,"caption":"Meta"},"image":{"@id":"https:\/\/engineering.fb.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Engineering\/","https:\/\/x.com\/fb_engineering"]},[]]}},"jetpack_featured_media_url":"https:\/\/engineering.fb.com\/wp-content\/uploads\/2019\/03\/OSIBBlue1.jpg","jetpack_shortlink":"https:\/\/wp.me\/pa0Lhq-3jH","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/engineering.fb.com\/wp-json\/wp\/v2\/posts\/12753","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/engineering.fb.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/engineering.fb.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/engineering.fb.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/engineering.fb.com\/wp-json\/wp\/v2\/comments?post=12753"}],"version-history":[{"count":5,"href":"https:\/\/engineering.fb.com\/wp-json\/wp\/v2\/posts\/12753\/revisions"}],"predecessor-version":[{"id":12764,"href":"https:\/\/engineering.fb.com\/wp-json\/wp\/v2\/posts\/12753\/revisions\/12764"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/engineering.fb.com\/wp-json\/wp\/v2\/media\/12754"}],"wp:attachment":[{"href":"https:\/\/engineering.fb.com\/wp-json\/wp\/v2\/media?parent=12753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/engineering.fb.com\/wp-json\/wp\/v2\/categories?post=12753"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/engineering.fb.com\/wp-json\/wp\/v2\/tags?post=12753"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/engineering.fb.com\/wp-json\/wp\/v2\/coauthors?post=12753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}