Fix tests on windows (#159)

This commit is contained in:
Zsolt Dollenstein 2018-04-23 19:23:36 +01:00 committed by Łukasz Langa
parent 5e1e1a1820
commit c012c70176

View File

@ -1,5 +1,6 @@
#!/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")