{"id":13772559,"url":"https://github.com/boxed/hammett","last_synced_at":"2025-04-08T04:16:45.103Z","repository":{"id":45844575,"uuid":"247491171","full_name":"boxed/hammett","owner":"boxed","description":"Fast python test runner, compatible with a subset of pytest","archived":false,"fork":false,"pushed_at":"2024-09-23T10:59:33.000Z","size":335,"stargazers_count":93,"open_issues_count":7,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T17:06:39.099Z","etag":null,"topics":["pytest","python","testing","testing-tools"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boxed.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","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":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-15T15:13:14.000Z","updated_at":"2025-02-07T22:52:31.000Z","dependencies_parsed_at":"2024-10-22T21:38:27.782Z","dependency_job_id":null,"html_url":"https://github.com/boxed/hammett","commit_stats":{"total_commits":126,"total_committers":4,"mean_commits":31.5,"dds":"0.23015873015873012","last_synced_commit":"fcef4ad1a79c5fa9719c06e59f3ea82447758d93"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxed%2Fhammett","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxed%2Fhammett/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxed%2Fhammett/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxed%2Fhammett/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boxed","download_url":"https://codeload.github.com/boxed/hammett/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247773721,"owners_count":20993639,"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":["pytest","python","testing","testing-tools"],"created_at":"2024-08-03T17:01:05.363Z","updated_at":"2025-04-08T04:16:45.080Z","avatar_url":"https://github.com/boxed.png","language":"Python","readme":"hammett\n=======\n\n.. image:: https://travis-ci.org/boxed/hammett.svg?branch=master\n    :target: https://travis-ci.org/boxed/hammett\n\n.. image:: https://codecov.io/gh/boxed/hammett/branch/master/graph/badge.svg\n  :target: https://codecov.io/gh/boxed/hammett\n\n\nHammett is a fast python test runner that aims to be compatible with the parts\nof pytest most people use (unless that conflicts with the goal of being fast).\nIt also adds some features that can dramatically improve your testing experience\nif you adapt more fully to hammett.\n\n\nHow much faster is hammett?\n---------------------------\n\nThis will depend on how fast your test suite is.\nHammett isn't magic, it's just a runner made by someone who cares about\nperformance a lot. It aims to have minimal startup overhead and minimal\noverhead for each test. I have written some benchmarks for measuring this\noverhead which you can find at https://github.com/boxed/test-benchmarks (TL;DR\nif your test suite is \u003c 1s in pytest you will see VAST improvements, if it's\nminutes or hours, not so much).\n\nA real world example is running the test suite of tri.declarative:\n\n- pytest: ~860 ms\n- hammett: ~160 ms\n\nOr iommi:\n\n- pytest: ~10 s\n- hammett: ~8 s\n\n\nBut even if your test suite is big and slow you can still get some big\nimprovements out of hammett if you often run just one file or one test:\n\nIn iommi, running `-k test_render_attrs_none`\n\n- pytest: ~1.3 s\n- hammett: ~0.6 s\n\nAll of this is from a full and clean run. Hammett has features to avoid that!\n\n\nTests locked to a module\n------------------------\n\nIn hammett you can optionally name your test files `module__tests.py` (that's\ntwo `_`). This tells hammett that if you change `module` only the tests in\n`module__tests.py` needs to be run. You can place those files either in the\ntests directory or right next to the module you're testing.\n\n\nRun just relevant tests\n------------------------\n\nHammett keeps track of what modules and what tests have changed and runs only\nthe tests it needs to. Assuming you lock your tests to a module like above.\n\nIf hammett gets confused you can delete the `.hammett-db` file and it will\nstart from scratch.\n\n\nPytest features that work in hammett\n------------------------------------\n\n- `pytest.mark`\n- parametrized tests\n- fixtures\n- `with pytest.raises`\n\n\nSome plugins work, but you have to specify to load them in setup.cfg:\n\n.. code:: ini\n\n    [hammett]\n    plugins=\n        pytest_django\n\n\nUsage\n------\n\nFirst install: :code:`pip install hammett`\n\nThen run hammett: :code:`python -m hammett`\n\nHopefully it will run your entire test suite!\n\nHammett works with some pytest plugins, most notably pytest-django, at least\nfor some projects. You need to specify what plugins hammett loads manually\nin setup.cfg though.\n\n\nKeeping pytest compatibility\n----------------------------\n\nIf you want to use the hammett specific feature of `module__tests.py`-style\ntest files, you can still keep compatibility with pytest by specifying the\nmodule of your project and the tests file pattern, like this:\n\n.. code::\n\n    testpaths=\n        tests\n        my_project\n    python_files=\n        *__tests.py\n\nAlso keep importing pytest instead of hammett obviously.\n\n\nLicense\n-------\n\nBSD\n","funding_links":[],"categories":["Python","Testing Frameworks"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxed%2Fhammett","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboxed%2Fhammett","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxed%2Fhammett/lists"}