All tools / Testing & code health
falsify
Find pytest tests that pass for the wrong reason.
Buy falsify for $49One payment of $49, plus sales tax where it applies, and every future update. Delivered as a private GitHub repository you're invited to.
Runs inside Lina. Extracted from the guard tests that keep Lina's own test suite honest.
See it work
falsify check
app/orders.py:12:9: [success-from-except] returns success (`{'ok': True}`) from inside an `except` block, so the caller cannot tell this failure from a real success
fix: return the failure (ok: False, an error status, or re-raise). If success is right here, name why in the payload (e.g. a `skipped` key) or add `# falsify: ok <why>`.
tests/test_orders.py:9:5: [phantom-patch] patches `app.client.fetch_rates` with raising=False, and `app.client.fetch_rates` does not exist, so this line patches nothing
fix: point the patch at the real name and drop raising=False / create=True, so the next rename fails loudly.
tests/test_orders.py:10:5: [unfalsifiable-assert] `or True` short-circuits the assertion to always-true
fix: assert on the real outcome. For a deliberate reflexivity check, add `# falsify: ok <why>`.
falsify: 3 finding(s) (5 files checked, 9 rules)
falsify dead-asserts
falsify dead-asserts: 1 assertion(s) never executed. They cannot fail, so they occupy the place where a real check would go.
tests/test_orders.py:25: in test_note_text(): assert 'limit' in note['text']
(3/4 lines of test_note_text ran)
fix: make the line run, or if it is a deliberate tripwire for a state that is not today's, add `# falsify: ok <why>` above it.
falsify comment-guards
falsify comment-guards: 1 test(s) pass only because of a comment. They cannot tell working code from code that was commented out.
tests/test_orders.py::test_retry_limit_is_set
only a comment holds 'RETRY_LIMIT' in app/settings.py
fix: match against falsify.source_scan.code_only(path) instead of raw text. If the test's subject really is a comment, add `# falsify: ok <why>` to its assert.
What it does
A pytest plugin and command that finds tests which pass for the wrong reason: assertions that are always true, assertions that never run, patches aimed at names that don't exist, and checks that only a comment satisfies.
- Assertions that cannot fail
- Flags asserts that are always true: or True, constants and literals, the same name or attribute on both sides of ==, and unittest forms such as assertTrue(1). Values that can be empty are left alone.
- Assertions that never ran
- falsify dead-asserts runs your suite under coverage.py and lists every assert that never executed, reading skips from pytest's own report.
- Patches that patch nothing
- Finds monkeypatch and mock.patch calls aimed at a name that doesn't exist, so the real code was never replaced.
- Checks only a comment satisfies
- falsify comment-guards reruns suspect tests against a copy of your project with comments stripped, and names each one that then fails. Your working tree is never touched.
- Breakage waiting for one line to run
- Lazy imports of names that no longer exist, calls with more arguments than the function takes, and a name used above its own local import.
- Hangs and hidden failures
- Waits with no timeout, await inside a lock, and except blocks that return success.
- Fits your workflow
- pytest --falsify fails the session on a finding. Configure it in pyproject.toml, get text or JSON, and excuse a line only with a written reason.
What you get
falsify 1.0.4: the pytest plugin and the falsify command, with 226 automated tests.
A commercial license. Use it and change it in your own projects and your clients' projects. Don't share or resell the source. Read the license.
Every update. New versions land in the same repository; git pull to get them.
Requirements
Python 3.10 or newer. The static checks need no other package (tomli comes with it on Python 3.10). The [coverage] extra adds coverage.py, which falsify dead-asserts needs.
How buying works
- Enter your GitHub username. You'll see the account before you pay, so you can check it's yours.
- Pay $49, plus any sales tax shown at checkout, on Stripe's checkout page.
- Accept the invitation GitHub emails you. Signed in as that account, you'll also find it at
github.com/dominares-tools/falsify/invitations. Invitations expire after 7 days; you can get a new one any time. - Clone and install:
git clone https://github.com/dominares-tools/falsify.gitPrivate repo: sign in to GitHub on this computer first. Run
gh auth loginand choose HTTPS, or give git a personal access token when it asks for a password. To use an SSH key instead, clonegit@github.com:dominares-tools/falsify.git.python3 -m venv .venv && . .venv/bin/activate pip install ./falsify
Questions
Do I need GitHub?
Yes. Access is a read-only invitation to a private repository, sent to the GitHub account you choose.
Can I get a refund?
Yes, within 14 days, no questions asked. Access ends when the refund goes through. Refund policy.
Who takes the payment?
Payments are handled by Stripe, which works out sales tax. Your receipt and card statement show Link (LINK.COM*), Stripe's checkout service.
Something wrong?
Email support@dominares.org. Every buyer of a tool shares its repository, so support happens by email rather than in GitHub issues.