{"id":13936261,"url":"https://github.com/Yelp/Testify","last_synced_at":"2025-07-19T21:32:14.606Z","repository":{"id":728339,"uuid":"376878","full_name":"Yelp/Testify","owner":"Yelp","description":"A more pythonic testing framework.","archived":false,"fork":false,"pushed_at":"2023-10-09T23:51:45.000Z","size":1391,"stargazers_count":305,"open_issues_count":10,"forks_count":66,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-06-18T18:03:50.868Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"coreos/rkt","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Yelp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2009-11-18T06:27:31.000Z","updated_at":"2025-05-10T19:43:21.000Z","dependencies_parsed_at":"2023-10-04T05:09:56.734Z","dependency_job_id":"c40dc91c-fd8d-437f-9ac1-645b57a734a3","html_url":"https://github.com/Yelp/Testify","commit_stats":{"total_commits":758,"total_committers":61,"mean_commits":"12.426229508196721","dds":0.8271767810026385,"last_synced_commit":"50045dfc239e0118a88487b95b27a9c17732b4cf"},"previous_names":[],"tags_count":65,"template":false,"template_full_name":null,"purl":"pkg:github/Yelp/Testify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yelp%2FTestify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yelp%2FTestify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yelp%2FTestify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yelp%2FTestify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yelp","download_url":"https://codeload.github.com/Yelp/Testify/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yelp%2FTestify/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266019657,"owners_count":23864916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-07T23:02:31.724Z","updated_at":"2025-07-19T21:32:09.597Z","avatar_url":"https://github.com/Yelp.png","language":"Python","readme":"# Testify - A Testing Framework\n\n*PLEASE NOTE:* Yelp is in the process of switching to [py.test](http://pytest.org/). We recommend you use it instead of Testify.\n\n[![Build Status](https://travis-ci.org/Yelp/Testify.png?branch=master)](https://travis-ci.org/Yelp/Testify)\n\nTestify is a replacement for Python's unittest module and nose. It is modeled\nafter unittest, and existing unittest classes are fully supported.\n\nHowever, Testify has features above and beyond unittest:\n\n  - Class-level setup and teardown fixture methods, which are run only once for\n    an entire class of test methods.\n\n  - A decorator-based approach to fixture methods, enabling features like\n    lazily-evaluated attributes and context managers for tests.\n\n  - Enhanced test discovery. Testify can drill down into packages to find test\n    cases (similiar to nose).\n\n  - Support for detecting and running test suites, grouped by modules,\n    classes, or individual test methods.\n\n  - Pretty test runner output (hooray color!).\n\n  - Extensible plugin system for adding additional functionality around\n    reporting.\n\n  - Comes complete with other handy testing utilities, including turtle (for\n    mocking), code coverage integration, profiling, and numerous common\n    assertion helpers for easier debugging.\n\n  - More Pythonic naming conventions.\n\n### Example Test Case\n\n```python\nfrom testify import *\n\nclass AdditionTestCase(TestCase):\n\n    @class_setup\n    def init_the_variable(self):\n        self.variable = 0\n\n    @setup\n    def increment_the_variable(self):\n        self.variable += 1\n\n    def test_the_variable(self):\n        assert_equal(self.variable, 1)\n\n    @suite('disabled', reason='ticket #123, not equal to 2 places')\n    def test_broken(self):\n        # raises 'AssertionError: 1 !~= 1.01'\n        assert_almost_equal(1, 1.01, threshold=2)\n\n    @teardown\n    def decrement_the_variable(self):\n        self.variable -= 1\n\n    @class_teardown\n    def get_rid_of_the_variable(self):\n        self.variable = None\n\nif __name__ == \"__main__\":\n    run()\n```\n\n### Unittest Compatibility\n\nTestify will discover and run ``unittests`` without any code changes, just\npoint it to a directory containing your tests:\n\n```bash\n$ testify my_unittests/foo_test.py\n```\n\nTo take advantage of more advanced Testify features, just replace\n``unittest.TestCase`` with ``testify.TestCase``!\n\n### Fixtures\n\nTestify provides the following fixtures for your enjoyment:\n\n  - ``@setup``: Run before each individual test method on the ``TestCase``(that\n    is, all methods that begin with 'test').\n\n  - ``@teardown``: Like ``setup``, but run after each test completes\n    (regardless of success or failure).\n\n  - ``@class_setup``: Run before a ``TestCase`` begins executing its tests.\n    Note that this not a class method; you still have access to the same\n    ``TestCase`` instance as your tests.\n\n  - ``@class_teardown``: Like ``class_setup``, but run after all tests complete\n    (regardless of success or failure).\n\n  - ``@setup_teardown``: A context manager for individual tests, where test\n    execution occurs during the yield. For example:\n\n    ```python\n    @setup_teardown\n    def mock_something(self):\n        with mock.patch('foo') as foo_mock:\n            self.foo_mock = foo_mock\n            yield\n        # this is where you would do teardown things\n    ```\n\n  - ``@class_setup_teardown``: Like ``setup_teardown``, but all of the\n    ``TestCase``'s methods are run when this yields.\n\n  - ``@let``: This declares a lazily-evaluated attribute of the ``TestCase``.\n    When accessed, this attribute will be computed and cached for the life of\n    the test (including setup and teardown). For example:\n\n    ```python\n    @let\n    def expensive_attribute(self):\n      return expensive_function_call()\n\n    def test_something(self):\n      assert self.expensive_attribute\n\n    def test_something_else(self):\n      # no expensive call\n      assert True\n    ```\n\n#### Order of Execution\n\nIn pseudo code, Testify follows this schedule when running your tests:\n\n```\n   Run all 'class_setup' methods\n   Enter all 'class_setup_teardown' context managers\n   For each method beginning with 'test':\n       Run all 'setup' methods\n       Enter all 'setup_teardown' context managers\n           Run the method and record failure or success\n       Exit all 'setup_teardown' context managers\n       Run all 'teardown' methods\n   Exit all 'class_setup_teardown' context managers\n   Run all 'class_teardown' methods\n```\n\n##### ...When Subclassing\n\nYour fixtures are just decorated methods, so they can be inherited and\noverloaded as expected. When you introduce subclasses and mixins into the...\nmix, things can get a little crazy. For this reason, Testify makes a couple\nguarantees about how your fixtures are run:\n\n * A subclass's fixture context is always contained within its parent's fixture\n   context (as determined by the usual\n   [MRO](http://www.python.org/download/releases/2.3/mro/)). That is, fixture\n   context is pushed and popped in FILO order.\n\n * Fixtures of the same type (and defined at the same level in the class\n   heirarchy) will be run in the order they are defined on the class.\n","funding_links":[],"categories":["Programming","Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYelp%2FTestify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FYelp%2FTestify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYelp%2FTestify/lists"}