pre-commit-hooks/tests
2017-08-24 15:27:08 +00:00
..
__init__.py Initial commit. 2014-03-13 08:41:35 -07:00
autopep8_wrapper_test.py Require a newer version of autopep8 2017-03-13 14:34:13 -07:00
check_added_large_files_test.py Use new git lfs (broken due to lfs returning non-lfs files) 2017-07-26 02:59:08 -07: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 Use asottile/add-trailing-comma 2017-07-12 18:58:30 -07:00
check_executables_have_shebangs_test.py Upgrade add-trailing-comma to 0.4.1 2017-07-15 13:06:38 -07:00
check_json_test.py Upgrade add-trailing-comma to 0.4.1 2017-07-15 13:06:38 -07:00
check_merge_conflict_test.py Use asottile/add-trailing-comma 2017-07-12 18:58:30 -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 Upgrade add-trailing-comma to 0.4.1 2017-07-15 13:06:38 -07:00
check_xml_test.py Upgrade add-trailing-comma to 0.4.1 2017-07-15 13:06:38 -07:00
check_yaml_test.py Upgrade add-trailing-comma to 0.4.1 2017-07-15 13:06:38 -07:00
conftest.py Increase robustness of tests involving git 2016-06-12 18:58:30 +02:00
debug_statement_hook_test.py debug statements hook works for non-utf8 files 2017-08-14 20:20:32 -07:00
detect_aws_credentials_test.py Upgrade pre-commit hooks 2017-07-17 17:41:44 -07: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
file_contents_sorter_test.py Use asottile/add-trailing-comma 2017-07-12 18:58:30 -07:00
fix_encoding_pragma_test.py Use asottile/add-trailing-comma 2017-07-12 18:58:30 -07:00
forbid_new_submodules_test.py Don't gpg sign during test 2017-07-05 12:24:03 -07:00
meta_test.py Use 0.15.0 types 2017-07-02 20:57:10 -07:00
pretty_format_json_test.py Upgrade add-trailing-comma to 0.4.1 2017-07-15 13:06:38 -07: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 Use asottile/add-trailing-comma 2017-07-12 18:58:30 -07:00
sort_simple_yaml_test.py Add sort-simple-yaml hook (originally private hook from yelp_pre_commit_hooks) 2017-06-23 16:26:00 -07:00
string_fixer_test.py Upgrade add-trailing-comma to 0.4.1 2017-07-15 13:06:38 -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 Use asottile/add-trailing-comma 2017-07-12 18:58:30 -07: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