diff --git a/parfive/tests/test_downloader.py b/parfive/tests/test_downloader.py index 1766fae..a93f337 100644 --- a/parfive/tests/test_downloader.py +++ b/parfive/tests/test_downloader.py @@ -3,6 +3,7 @@ import threading from pathlib import Path from tempfile import gettempdir +from time import sleep from unittest import mock from unittest.mock import patch @@ -523,9 +524,8 @@ def __init__(self, *args, **kwargs): def run(self): self.result = self._target(*self._args, **self._kwargs) - @skip_windows -def test_download_out_of_main_thread(httpserver, tmpdir): +def test_download_out_of_main_thread(httpserver, tmpdir, recwarn): tmpdir = str(tmpdir) httpserver.serve_content( "SIMPLE = T", headers={"Content-Disposition": "attachment; filename=testfile.fits"} @@ -537,10 +537,10 @@ 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.", - ): - thread.join() + thread.join() validate_test_file(thread.result) + + assert len(recwarn) > 0 + assert any(['This download has been started in a thread which is not the main thread. You will not be able to interrupt the download.' == + w.message.args[0] for w in recwarn]) \ No newline at end of file