URL:
https://github.com/freeipa/freeipa/pull/1380
Author: tiran
Title: #1380: make fastcheck -- run linters and tests in 30 seconds
Action: opened
PR body:
"""
Are you also annoyed by the fact that you have waited an hour for CI to finish -- only to
find out that your PR has a PEP 8 violation in a file? ``make fastcheck`` to your rescue!
It checks pylint, pep8 and ipatests' unit tests in about 30 seconds on both (!) Python
2 and 3:
```
$ time make fastcheck
...
real 0m29,417s
user 1m18,018s
sys 0m2,637s
```
## Add make targets for fast linting and testing
Fast linting only needs modified files with pylint and diff with
pycodestyle. It's good enough to detect most code errors very fast. It
typically takes less than 10 seconds. A complete full pylint run uses
all CPU cores for several minutes. PEP 8 violations are typically
reported after 30 minutes to several hours on Travis CI.
Fast lintings uses git diff and git merge-base to find all modified
files in a branch or working tree. There is no easy way to find the
branch source. On Travis the information is provided by Travis. For
local development it's a new variable IPA_GIT_BRANCH in VERSION.m4.
Fast testing execute all unit tests that do not depend on ipalib.api.
In total it takes about 30-40 seconds (!) to execute linting, PEP 8 checks
and unittests for both Python 2 and 3.
## Add marker needs_ipaapi and option to skip tests
The new marker needs_ipaapi is used to mark tests that needs an
initialized API (ipalib.api) or some sort of other API services (running
LDAP server) to work. Some packages use api.Command or api.Backend on
module level. They are not marked but rather skipped entirely.
A new option ``skip-ipaapi`` is added to skip all API based tests. With
the option, only simple unit tests are executed. As of now, freeIPA
contains more than 500 unit tests that can be executed in about 5
seconds.
"""
To pull the PR as Git branch:
git remote add ghfreeipa
https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1380/head:pr1380
git checkout pr1380