Use fixtures for the symlink tests to fix appveyor
diff --git a/testing/resources/broken_symlink b/testing/resources/broken_symlink deleted file mode 120000 index ee1f6cb..0000000 --- a/testing/resources/broken_symlink +++ /dev/null
@@ -1 +0,0 @@ -does_not_exist \ No newline at end of file
diff --git a/testing/resources/working_symlink b/testing/resources/working_symlink deleted file mode 120000 index 20b5061..0000000 --- a/testing/resources/working_symlink +++ /dev/null
@@ -1 +0,0 @@ -does_exist \ No newline at end of file
diff --git a/tests/check_symlinks_test.py b/tests/check_symlinks_test.py index 19bb5b4..0414df5 100644 --- a/tests/check_symlinks_test.py +++ b/tests/check_symlinks_test.py
@@ -3,16 +3,21 @@ import pytest from pre_commit_hooks.check_symlinks import check_symlinks -from testing.util import get_resource_path -@pytest.mark.xfail(os.name == 'nt', reason='No symlink support on windows') +xfail_symlink = pytest.mark.xfail(os.name == 'nt', reason='No symlink support') + + +@xfail_symlink @pytest.mark.parametrize( - ('filename', 'expected_retval'), ( - ('broken_symlink', 1), - ('working_symlink', 0), - ), + ('dest', 'expected'), (('exists', 0), ('does-not-exist', 1)), ) -def test_check_symlinks(filename, expected_retval): - ret = check_symlinks([get_resource_path(filename)]) - assert ret == expected_retval +def test_check_symlinks(tmpdir, dest, expected): # pragma: no cover (symlinks) + tmpdir.join('exists').ensure() + symlink = tmpdir.join('symlink') + symlink.mksymlinkto(tmpdir.join(dest)) + assert check_symlinks((symlink.strpath,)) == expected + + +def test_check_symlinks_normal_file(tmpdir): + assert check_symlinks((tmpdir.join('f').ensure().strpath,)) == 0