Anthony Sottile | da88228 | 2016-01-14 19:03:11 -0800 | [diff] [blame^] | 1 | import os |
| 2 | |
Benjamin Chess | 896c0cf | 2016-01-14 15:25:46 -0800 | [diff] [blame] | 3 | import pytest |
| 4 | |
| 5 | from pre_commit_hooks.check_symlinks import check_symlinks |
| 6 | from testing.util import get_resource_path |
| 7 | |
| 8 | |
Anthony Sottile | da88228 | 2016-01-14 19:03:11 -0800 | [diff] [blame^] | 9 | @pytest.mark.xfail(os.name == 'nt', reason='No symlink support on windows') |
Benjamin Chess | 896c0cf | 2016-01-14 15:25:46 -0800 | [diff] [blame] | 10 | @pytest.mark.parametrize(('filename', 'expected_retval'), ( |
| 11 | ('broken_symlink', 1), |
| 12 | ('working_symlink', 0), |
| 13 | )) |
| 14 | def test_check_symlinks(filename, expected_retval): |
| 15 | ret = check_symlinks([get_resource_path(filename)]) |
| 16 | assert ret == expected_retval |