X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/8a82e0bf9af1182563abb8bfb0c4e87e836feb95..36bed855e11b119adc4cd5b3ad87e2da965928ba:/tests/test_black.py diff --git a/tests/test_black.py b/tests/test_black.py index 08a3f31..7389da9 100644 --- a/tests/test_black.py +++ b/tests/test_black.py @@ -731,7 +731,10 @@ class BlackTestCase(unittest.TestCase): 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) @@ -861,7 +864,8 @@ class BlackTestCase(unittest.TestCase): Path(THIS_DIR / "include_exclude_tests/b/dont_exclude/a.py"), Path(THIS_DIR / "include_exclude_tests/b/dont_exclude/a.pyi"), ] - sources.extend(black.gen_python_files_in_dir(path, include, exclude)) + this_abs = THIS_DIR.resolve() + sources.extend(black.gen_python_files_in_dir(path, this_abs, include, exclude)) self.assertEqual(sorted(expected), sorted(sources)) def test_empty_include(self) -> None: @@ -879,9 +883,10 @@ class BlackTestCase(unittest.TestCase): Path(path / "b/.definitely_exclude/a.py"), Path(path / "b/.definitely_exclude/a.pyi"), ] + this_abs = THIS_DIR.resolve() sources.extend( black.gen_python_files_in_dir( - path, empty, re.compile(black.DEFAULT_EXCLUDES) + path, this_abs, empty, re.compile(black.DEFAULT_EXCLUDES) ) ) self.assertEqual(sorted(expected), sorted(sources)) @@ -898,9 +903,10 @@ class BlackTestCase(unittest.TestCase): Path(path / "b/.definitely_exclude/a.py"), Path(path / "b/.definitely_exclude/a.pyi"), ] + this_abs = THIS_DIR.resolve() sources.extend( black.gen_python_files_in_dir( - path, re.compile(black.DEFAULT_INCLUDES), empty + path, this_abs, re.compile(black.DEFAULT_INCLUDES), empty ) ) self.assertEqual(sorted(expected), sorted(sources))