]>
git.madduck.net Git - etc/vim.git/commitdiff
madduck's git repository
Every one of the projects in this repository is available at the canonical
URL git://git.madduck.net/madduck/pub/<projectpath> — see
each project's metadata for the exact URL.
All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@ git. madduck. net .
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
SSH access, as well as push access can be individually
arranged .
If you use my repositories frequently, consider adding the following
snippet to ~/.gitconfig and using the third clone URL listed for each
project:
[url "git://git.madduck.net/madduck/"]
insteadOf = madduck:
summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (parent:
362b722 )
-def event_loop(close: bool ) -> Iterator[None]:
+def event_loop() -> Iterator[None]:
policy = asyncio.get_event_loop_policy()
loop = policy.new_event_loop()
asyncio.set_event_loop(loop)
policy = asyncio.get_event_loop_policy()
loop = policy.new_event_loop()
asyncio.set_event_loop(loop)
- if close:
- loop.close()
with src.open("r") as fobj:
self.assertEqual(fobj.read(), "print('hello')")
with src.open("r") as fobj:
self.assertEqual(fobj.read(), "print('hello')")
- @event_loop(close=False )
def test_cache_multiple_files(self) -> None:
mode = black.FileMode()
with cache_dir() as workspace, patch(
def test_cache_multiple_files(self) -> None:
mode = black.FileMode()
with cache_dir() as workspace, patch(
black.write_cache({}, [], mode)
self.assertTrue(workspace.exists())
black.write_cache({}, [], mode)
self.assertTrue(workspace.exists())
- @event_loop(close=False )
def test_failed_formatting_does_not_get_cached(self) -> None:
mode = black.FileMode()
with cache_dir() as workspace, patch(
def test_failed_formatting_does_not_get_cached(self) -> None:
mode = black.FileMode()
with cache_dir() as workspace, patch(
mock.side_effect = OSError
black.write_cache({}, [], mode)
mock.side_effect = OSError
black.write_cache({}, [], mode)
- @event_loop(close=False )
@patch("black.ProcessPoolExecutor", MagicMock(side_effect=OSError))
def test_works_in_mono_process_only_environment(self) -> None:
with cache_dir() as workspace:
@patch("black.ProcessPoolExecutor", MagicMock(side_effect=OSError))
def test_works_in_mono_process_only_environment(self) -> None:
with cache_dir() as workspace:
f.write_text('print("hello")\n')
self.invokeBlack([str(workspace)])
f.write_text('print("hello")\n')
self.invokeBlack([str(workspace)])
- @event_loop(close=False )
def test_check_diff_use_together(self) -> None:
with cache_dir():
# Files which will be reformatted.
def test_check_diff_use_together(self) -> None:
with cache_dir():
# Files which will be reformatted.
self.assertNotIn(path, normal_cache)
self.assertEqual(actual, expected)
self.assertNotIn(path, normal_cache)
self.assertEqual(actual, expected)
- @event_loop(close=False )
def test_multi_file_force_pyi(self) -> None:
reg_mode = black.FileMode()
pyi_mode = black.FileMode(is_pyi=True)
def test_multi_file_force_pyi(self) -> None:
reg_mode = black.FileMode()
pyi_mode = black.FileMode(is_pyi=True)
self.assertNotIn(path, normal_cache)
self.assertEqual(actual, expected)
self.assertNotIn(path, normal_cache)
self.assertEqual(actual, expected)
- @event_loop(close=False )
def test_multi_file_force_py36(self) -> None:
reg_mode = black.FileMode()
py36_mode = black.FileMode(target_versions=black.PY36_VERSIONS)
def test_multi_file_force_py36(self) -> None:
reg_mode = black.FileMode()
py36_mode = black.FileMode(target_versions=black.PY36_VERSIONS)