πtest /ΛlΙmΙn tΙst/ Noun.
1. A test which appears to test a feature, but in fact does not test that feature at all.
[us. I reviewed that pull request and found one πtest that doesn't test right.]
What?
A unittest runner for detecting
Why?
Good development practice dictates that new features should be accompanied with new tests. Good tests can identify regressions and accidental removal of features.
A
This library identifies
Testing for
Quickstart
pip install lemontest
manage.py test --testrunner=lemontest.djangorunner.DjangoLemonTestRunner --to-branch=master --from-branch=feature/123
It must be a git repository.
Lemontest needs a git repository to be able to revert business logic.
Travis CI
Travis conveniently provides environment variables we can use.
pip install lemontest
manage.py test --testrunner=lemontest.djangorunner.DjangoLemonTestRunner --to-branch=$TRAVIS_BRANCH --from-branch=$TRAVIS_PULL_REQUEST_SHA
Algorithm
- Get source files that have changed (git diff)
- Identify test source files (use unittest discovery and intersect with step 1)
- Identify business logic files (set difference between step 1 and step2)
- Use git to revert business logic code (git checkout)
- Run tests that have changed
- Raise an exception for each test that succeeds