| 1 | all: |
| 2 | @echo "make test(test_basic, test_diff, test_unit)" |
| 3 | @echo "make fasttest" |
| 4 | @echo "make benchmark" |
| 5 | @echo "make pypireg" |
| 6 | @echo "make coverage" |
| 7 | @echo "make check" |
| 8 | @echo "make clean" |
| 9 | |
| 10 | PYTHON?=python |
| 11 | COVERAGE?=coverage |
| 12 | |
| 13 | TEST_DIR=test |
| 14 | |
| 15 | test: test_basic test_diff test_unit |
| 16 | fasttest: test_fast |
| 17 | |
| 18 | test_basic: |
| 19 | @echo '---> Running basic test' |
| 20 | @${PYTHON} autopep8.py --aggressive test/example.py > .tmp.test.py |
| 21 | pycodestyle --repeat .tmp.test.py |
| 22 | @rm .tmp.test.py |
| 23 | |
| 24 | test_diff: |
| 25 | @echo '---> Running --diff test' |
| 26 | @cp test/example.py .tmp.example.py |
| 27 | @${PYTHON} autopep8.py --aggressive --diff .tmp.example.py > .tmp.example.py.patch |
| 28 | patch < .tmp.example.py.patch |
| 29 | @rm .tmp.example.py.patch |
| 30 | pycodestyle --repeat .tmp.example.py && ${PYTHON} -m py_compile .tmp.example.py |
| 31 | @rm .tmp.example.py |
| 32 | |
| 33 | test_unit: |
| 34 | @echo '---> Running unit tests' |
| 35 | @${PYTHON} test/test_autopep8.py |
| 36 | |
| 37 | test_fast: |
| 38 | @echo '[run]' > .pytest.coveragerc |
| 39 | @echo 'branch = True' >> .pytest.coveragerc |
| 40 | @echo 'omit = "*/site-packages/*"' >> .pytest.coveragerc |
| 41 | @echo '[report]' >> .pytest.coveragerc |
| 42 | @echo 'include = autopep8.py' >> .pytest.coveragerc |
| 43 | @AUTOPEP8_COVERAGE=1 py.test -n4 --cov-config .pytest.coveragerc \ |
| 44 | --cov-report term-missing --cov autopep8 test/test_autopep8.py |
| 45 | @rm .pytest.coveragerc .coverage |
| 46 | |
| 47 | test_ci: |
| 48 | pytest --cov-report xml --cov=autopep8 |
| 49 | @${PYTHON} test/acid.py -aaa --experimental test/example.py |
| 50 | @${PYTHON} test/acid.py --pycodestyle= -aaa --compare-bytecode --experimental test/example.py |
| 51 | @${PYTHON} test/acid.py --pycodestyle= --aggressive --line-range 550 610 test/inspect_example.py |
| 52 | @${PYTHON} test/acid.py --pycodestyle= --line-range 289 925 test/vectors_example.py |
| 53 | @${PYTHON} test/test_suite.py |
| 54 | |
| 55 | coverage: |
| 56 | @coverage erase |
| 57 | @AUTOPEP8_COVERAGE=1 ${COVERAGE} run --branch --parallel-mode --omit='*/site-packages/*' test/test_autopep8.py |
| 58 | @${COVERAGE} combine |
| 59 | @${COVERAGE} report --show-missing |
| 60 | @${COVERAGE} xml --include=autopep8.py |
| 61 | |
| 62 | open_coverage: coverage |
| 63 | @${COVERAGE} html |
| 64 | @python -m webbrowser -n "file://${PWD}/htmlcov/index.html" |
| 65 | |
| 66 | benchmark: |
| 67 | @echo '---> Benchmark of autopep8.py test/example.py' |
| 68 | @time ${PYTHON} autopep8.py --aggressive test/example.py > /dev/null |
| 69 | @echo '---> Benchmark of test_unit' |
| 70 | @time ${PYTHON} test/test_autopep8.py > /dev/null |
| 71 | @echo '---> Benchmark of autopep8.py -d test/*.py' |
| 72 | @time ${PYTHON} autopep8.py -d test/*.py > /dev/null |
| 73 | |
| 74 | readme: |
| 75 | @${PYTHON} update_readme.py |
| 76 | @rstcheck README.rst |
| 77 | @${PYTHON} -m doctest -v README.rst |
| 78 | |
| 79 | open_readme: readme |
| 80 | @python -m webbrowser -n "file://${PWD}/README.html" |
| 81 | |
| 82 | check: |
| 83 | pycodestyle \ |
| 84 | --ignore=E402,E226,E24,W50 \ |
| 85 | autopep8.py setup.py test/acid.py test/acid_pypi.py update_readme.py |
| 86 | pycodestyle \ |
| 87 | --max-line-length=300 test/test_autopep8.py |
| 88 | pylint \ |
| 89 | --reports=no \ |
| 90 | --msg-template='{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}' \ |
| 91 | --disable=bad-builtin \ |
| 92 | --disable=bad-continuation \ |
| 93 | --disable=fixme \ |
| 94 | --disable=import-error \ |
| 95 | --disable=invalid-name \ |
| 96 | --disable=locally-disabled \ |
| 97 | --disable=missing-docstring \ |
| 98 | --disable=no-member \ |
| 99 | --disable=no-self-use \ |
| 100 | --disable=not-callable \ |
| 101 | --disable=protected-access \ |
| 102 | --disable=redefined-builtin \ |
| 103 | --disable=star-args \ |
| 104 | --disable=super-on-old-class \ |
| 105 | --disable=too-few-public-methods \ |
| 106 | --disable=too-many-arguments \ |
| 107 | --disable=too-many-boolean-expressions \ |
| 108 | --disable=too-many-branches \ |
| 109 | --disable=too-many-instance-attributes \ |
| 110 | --disable=too-many-lines \ |
| 111 | --disable=too-many-locals \ |
| 112 | --disable=too-many-nested-blocks \ |
| 113 | --disable=too-many-public-methods \ |
| 114 | --disable=too-many-statements \ |
| 115 | --disable=undefined-loop-variable \ |
| 116 | --rcfile=/dev/null autopep8.py setup.py update_readme.py |
| 117 | pylint \ |
| 118 | --reports=no \ |
| 119 | --msg-template='{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}' \ |
| 120 | --errors-only \ |
| 121 | --disable=no-member \ |
| 122 | --rcfile=/dev/null \ |
| 123 | test/acid.py test/acid_pypi.py test/test_autopep8.py |
| 124 | ./autopep8.py --diff autopep8.py setup.py test/test_autopep8.py update_readme.py |
| 125 | |
| 126 | mutant: |
| 127 | @mut.py --disable-operator RIL -t autopep8 -u test.test_autopep8 -mc |
| 128 | |
| 129 | pypireg: |
| 130 | ${PYTHON} -m pip install twine build |
| 131 | ${PYTHON} -m build |
| 132 | ${PYTHON} -m twine upload dist/* |
| 133 | |
| 134 | clean: |
| 135 | rm -rf .tmp.test.py temp *.pyc *egg-info dist build \ |
| 136 | __pycache__ */__pycache__ */*/__pycache__ \ |
| 137 | htmlcov coverage.xml |
| 138 | |
| 139 | .PHONY: \ |
| 140 | all clean mutant pypireg test_basic test_unit \ |
| 141 | benchmark coverage open_coverage readme test_diff \ |
| 142 | check fasttest open_readme test test_fast test_ci |