{"id":15065812,"url":"https://github.com/tmarice/django-timed-tests","last_synced_at":"2025-04-10T13:34:19.229Z","repository":{"id":57422365,"uuid":"437602779","full_name":"tmarice/django-timed-tests","owner":"tmarice","description":"Get timing breakdown of your Django test suite","archived":false,"fork":false,"pushed_at":"2023-10-19T09:31:01.000Z","size":55,"stargazers_count":27,"open_issues_count":3,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T12:13:24.419Z","etag":null,"topics":["django","python","test-runner","testing","timing","unittest"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmarice.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-12T16:51:56.000Z","updated_at":"2025-03-13T12:15:40.000Z","dependencies_parsed_at":"2024-10-13T01:40:54.421Z","dependency_job_id":"aa4fa225-febe-48e4-b4c8-dece412bd27d","html_url":"https://github.com/tmarice/django-timed-tests","commit_stats":{"total_commits":59,"total_committers":2,"mean_commits":29.5,"dds":0.05084745762711862,"last_synced_commit":"3f0feab8ab569aae788ffaf063ee5f5b92d7e895"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmarice%2Fdjango-timed-tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmarice%2Fdjango-timed-tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmarice%2Fdjango-timed-tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmarice%2Fdjango-timed-tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmarice","download_url":"https://codeload.github.com/tmarice/django-timed-tests/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248225870,"owners_count":21068078,"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":["django","python","test-runner","testing","timing","unittest"],"created_at":"2024-09-25T00:54:22.098Z","updated_at":"2025-04-10T13:34:19.210Z","avatar_url":"https://github.com/tmarice.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# django-timed-tests\n\u003e What gets measured gets improved.\n\n`django-timed-tests` produce the timing breakdown for your tests.\n\n## Requirements\n**Note: as of [cpython 3.12](https://github.com/python/cpython/pull/12271), timing functionality is supported by default**\n\nPython 3.6 through 3.12 supported.\n\nDjango 2.0 through 4.2 supported.\n\n**`django-timed-tests` only works if you're using Django's testing framework.**\n\n## Installation\nInstall using `pip`:\n```\npython -m pip install django-timed-tests\n```\n\n## Usage\nEdit your `settings.py`:\n```\nINSTALLED_APPS = [\n    ...\n    django_timed_tests,\n    ...\n]\n\nTEST_RUNNER = \"django_timed_tests.TimedTestRunner\"\n```\n\n`django-timed-tests` support the use of `--parallel`, `--debug-sql`, and `--pdb` flags.\n\n### Regular report\nThe regular report shows **10** slowest **passing** tests that were run, ordered by descending duration.\n\nThe next time you run your tests using `manage.py test`, you'll see something like:\n\n```\n.............\n----------------------------------------------------------------------\nRan 12 tests in 18.036s\n\nOK\n| Test                                       |   Duration (s) |\n|--------------------------------------------|----------------|\n| tests.examples.DummyTestCase1.test_dummy_3 |    3.0048      |\n| tests.examples.DummyTestCase3.test_dummy_3 |    3.0041      |\n| tests.examples.DummyTestCase2.test_dummy_3 |    3.00086     |\n| tests.examples.DummyTestCase3.test_dummy_2 |    2.0052      |\n| tests.examples.DummyTestCase1.test_dummy_2 |    2.00372     |\n| tests.examples.DummyTestCase2.test_dummy_2 |    2.00194     |\n| tests.examples.DummyTestCase3.test_dummy_1 |    1.0043      |\n| tests.examples.DummyTestCase1.test_dummy_1 |    1.00235     |\n| tests.examples.DummyTestCase2.test_dummy_1 |    1.00044     |\n| tests.examples.DummyTestCase3.test_dummy_0 |    0.000109295 |\n```\n\n### Full report\nFull report shows **all** passing tests, with a breakdown per module, test class, and test method.\n\nWhen you run `manage.py test --full-report`, you'll see something like:\n```\n..............\n----------------------------------------------------------------------\nRan 12 tests in 6.157s\n\nOK\n| Module         |   Duration (s) |\n|----------------|----------------|\n| tests.examples |        18.0088 |\n\n| Class                         |   Duration (s) |\n|-------------------------------|----------------|\n| tests.examples.DummyTestCase1 |        6.00306 |\n| tests.examples.DummyTestCase2 |        6.00299 |\n| tests.examples.DummyTestCase3 |        6.00273 |\n\n| Test                                       |   Duration (s) |\n|--------------------------------------------|----------------|\n| tests.examples.DummyTestCase2.test_dummy_3 |    3.00136     |\n| tests.examples.DummyTestCase3.test_dummy_3 |    3.00136     |\n| tests.examples.DummyTestCase1.test_dummy_3 |    3.00126     |\n| tests.examples.DummyTestCase3.test_dummy_2 |    2.00039     |\n| tests.examples.DummyTestCase1.test_dummy_2 |    2.00031     |\n| tests.examples.DummyTestCase2.test_dummy_2 |    2.00026     |\n| tests.examples.DummyTestCase1.test_dummy_1 |    1.00128     |\n| tests.examples.DummyTestCase2.test_dummy_1 |    1.00112     |\n| tests.examples.DummyTestCase3.test_dummy_1 |    1.0008      |\n| tests.examples.DummyTestCase2.test_dummy_0 |    0.000246959 |\n| tests.examples.DummyTestCase1.test_dummy_0 |    0.00022184  |\n| tests.examples.DummyTestCase3.test_dummy_0 |    0.000178818 |\n```\n\n### Combining with your own test runner\n`TimedTestRunner` tries to be minimally invasive, and integrating it into your custom test runner shouldn't be too complex.\n\nIf your custom runner just inherits from `DiscoverRunner`, without redefining `DiscoverRunner.test_runner`,  `DiscoverRunner.parallel_test_runner` and `DiscoverRunner.get_resultclass`, you should be fine with just inheriting `TimedTestRunner` and calling `super()` at the beginning of your overriden methods:\n\n```\nclass MyOwnTestRunner(TimedTestRunner):\n\n    def __init__(self, **kwargs):\n        super().__init__(**kwargs)\n\n        # Do something else\n\n    ...\n```\n\nIf your test runner also uses custom `TestRunner` or `TestResult` classes, best course of action would be to inspect the `django_timed_tests.runner` module to see which classes should be inherited and which attributes and method should be overridden.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmarice%2Fdjango-timed-tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmarice%2Fdjango-timed-tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmarice%2Fdjango-timed-tests/lists"}