pre-commit-hooks/tests
2017-07-17 21:19:35 +02:00
..
__init__.py Initial commit. 2014-03-13 08:41:35 -07:00
autopep8_wrapper_test.py Simplify the tests 2016-05-27 14:09:50 -07:00
check_added_large_files_test.py Increase robustness of tests involving git 2016-06-12 18:58:30 +02:00
check_ast_test.py Add a hook to verify python ast. 2015-08-04 13:48:30 -07:00
check_byte_order_marker_test.py Forbid files with a UTF-8 BOM 2016-03-18 10:59:31 -07:00
check_case_conflict_test.py Increase robustness of tests involving git 2016-06-12 18:58:30 +02:00
check_docstring_first_test.py Simplify the tests 2016-05-27 14:09:50 -07:00
check_json_test.py Displaying the filename when the check-json hook fails with a UnicodeDecodeError - fix #148 2016-11-12 09:15:10 +01:00
check_merge_conflict_test.py Remove pylint 2016-08-22 14:38:49 -07:00
check_no_commit_to_branch_test.py Add a no commit to specific branch hook. (#185) 2017-03-20 10:36:51 -07:00
check_symlinks_test.py Skip the symlink tests on windows 2016-01-14 19:03:11 -08:00
check_xml_test.py Add check-xml hook. 2015-01-17 10:30:58 -08:00
check_yaml_test.py Update project setup. 2014-04-13 22:09:26 -07:00
conftest.py Increase robustness of tests involving git 2016-06-12 18:58:30 +02:00
debug_statement_hook_test.py Update pre-commit hooks 2015-01-04 16:05:54 -08:00
detect_aws_credentials_test.py Add flag to detect-aws-credentials to allow missing keys 2017-02-10 12:54:03 -05:00
detect_private_key_test.py Detect Ed25519 keys as well 2016-12-26 19:09:53 +01:00
end_of_file_fixer_test.py Simplify the tests 2016-05-27 14:09:50 -07:00
fix_encoding_pragma_test.py Allow encoding pragma to be customizable 2016-08-12 10:11:10 -07:00
forbid_new_submodules_test.py Add a new hook to forbid new submodules 2016-11-30 09:56:42 -08:00
meta_test.py Add .pre-commit-hooks.yaml for forward compatibility 2017-01-21 18:03:59 -08:00
pretty_format_json_test.py Add unit test for --no-ensure-ascii option 2017-03-20 20:19:01 +08:00
README.md Update supported Python versions in tests/README.md 2017-07-17 21:19:35 +02:00
readme_test.py Add pyupgrade 2017-03-12 18:01:29 -07:00
requirements_txt_fixer_test.py requirements fixer output is similar to pip freeze 2016-07-03 04:10:20 +05:30
string_fixer_test.py Simplify the tests 2016-05-27 14:09:50 -07:00
tests_should_end_in_test_test.py Handling default django test filename of "tests.py" 2017-03-15 00:40:53 -07:00
trailing_whitespace_fixer_test.py Only return nonzero when rewriting whitespace 2017-02-07 09:45:31 -08:00
util_test.py Remove dependency on plumbum 2015-03-20 14:15:30 -07:00

Testing

The test will run with the following environments:

  • Python version 2.7
  • Python version 3.5
  • Python version 3.6
  • PyPy

Installing the test environment

Debian-based distributions (Ubuntu, Mint, etc.)

$ sudo apt install pypy python2.7 python3.5 python3.6 python-tox

Running the tests

Running the complete test suite

$ make test

If the tests failed whereas the ones from the last tag did not, your Git configuration might interfere with pre-commit-hooks. In this case, you can ignore your current Git configuration by setting a temporary environment variable:

$ env HOME=/tmp make test

Running only a specific test

If you are developing a new hook or adding features to an existing one, you may want to run the tests for that particular hook. The following command will run the wanted test on every supported Python version.

$ tox tests/<your_test>.py

If you want to run your test for a specific Python version (for a quicker execution), you can specify it with the -e option of tox. At the moment, the supported Python versions are 2.7 (-e py27), 3.5 (-e py35), and 3.6 (-e py36). For example:

$ tox -e py27 tests/<your_test>.py

You can run your specific test ignoring your own Git configuration like so:

$ env HOME=/tmp tox -e py27 tests/<your_test>.py