From 8f38c21094eb799870bf1959cf7a7c94bca38ac1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 5 Oct 2023 14:32:20 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- parfive/downloader.py | 2 +- parfive/tests/test_downloader.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/parfive/downloader.py b/parfive/downloader.py index e3290bb..29c3bba 100644 --- a/parfive/downloader.py +++ b/parfive/downloader.py @@ -229,7 +229,7 @@ def _add_shutdown_signals(loop, task): if threading.current_thread() != threading.main_thread(): warnings.warn( "This download has been started in a thread which is not the main thread. You will not be able to interrupt the download.", - UserWarning + UserWarning, ) return diff --git a/parfive/tests/test_downloader.py b/parfive/tests/test_downloader.py index 5d79e82..6351d70 100644 --- a/parfive/tests/test_downloader.py +++ b/parfive/tests/test_downloader.py @@ -474,7 +474,10 @@ def __init__(self, *args, **kwargs): def run(self): self.result = self._target(*self._args, **self._kwargs) + import warnings + + def test_download_out_of_main_thread(httpserver, tmpdir): tmpdir = str(tmpdir) httpserver.serve_content( @@ -486,8 +489,11 @@ def test_download_out_of_main_thread(httpserver, tmpdir): thread = CustomThread(target=dl.download) thread.start() - - with pytest.warns(UserWarning, match="This download has been started in a thread which is not the main thread. You will not be able to interrupt the download."): + + with pytest.warns( + UserWarning, + match="This download has been started in a thread which is not the main thread. You will not be able to interrupt the download.", + ): thread.join() validate_test_file(thread.result)