Skip symlink test if can't create one (#287)

This commit is contained in:
Zsolt Dollenstein 2018-06-01 23:47:07 +02:00 committed by Łukasz Langa
parent a80e037a9a
commit ef903ecd46

View File

@ -731,7 +731,10 @@ def test_no_files(self) -> None:
def test_broken_symlink(self) -> None:
with cache_dir() as workspace:
symlink = workspace / "broken_link.py"
symlink.symlink_to("nonexistent.py")
try:
symlink.symlink_to("nonexistent.py")
except OSError as e:
self.skipTest(f"Can't create symlinks: {e}")
result = CliRunner().invoke(black.main, [str(workspace.resolve())])
self.assertEqual(result.exit_code, 0)