Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 5, 2023
1 parent 3581273 commit 8f38c21
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion parfive/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 8 additions & 2 deletions parfive/tests/test_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)

0 comments on commit 8f38c21

Please sign in to comment.