Commit c012c701 authored by Zsolt Dollenstein's avatar Zsolt Dollenstein Committed by Łukasz Langa
Browse files

Fix tests on windows (#159)

parent 5e1e1a18
Loading
Loading
Loading
Loading
+7 −2
Changes for tests/test_black.py: 7 added lines, 2 removed lines.
Original line number Diff line number Diff line
#!/usr/bin/env python3
import asyncio
from concurrent.futures import ThreadPoolExecutor
from contextlib import contextmanager
from functools import partial
from io import StringIO
@@ -507,7 +508,9 @@ def test_cache_single_file_already_cached(self) -> None:

    @event_loop(close=False)
    def test_cache_multiple_files(self) -> None:
        with cache_dir() as workspace:
        with cache_dir() as workspace, patch(
            "black.ProcessPoolExecutor", new=ThreadPoolExecutor
        ):
            one = (workspace / "one.py").resolve()
            with one.open("w") as fobj:
                fobj.write("print('hello')")
@@ -577,7 +580,9 @@ def test_write_cache_creates_directory_if_needed(self) -> None:

    @event_loop(close=False)
    def test_failed_formatting_does_not_get_cached(self) -> None:
        with cache_dir() as workspace:
        with cache_dir() as workspace, patch(
            "black.ProcessPoolExecutor", new=ThreadPoolExecutor
        ):
            failing = (workspace / "failing.py").resolve()
            with failing.open("w") as fobj:
                fobj.write("not actually python")