| From f211b9851698d07cf218e78ebb39a337c8751df8 Mon Sep 17 00:00:00 2001 |
| From: Christopher Baines <mail@cbaines.net> |
| Date: Sat, 2 May 2020 15:19:58 +0100 |
| Subject: [PATCH] Fix test_download_futures_fail_triggers_shutdown with Python |
| 3.8 |
| |
| The behaviour of set_exception for futures changed in Python 3.8, it'll now |
| raise concurrent.futures.InvalidStateError if the future is already done [1], |
| which is the case in this test because set_result has already been called on |
| the future. |
| |
| 1: https://bugs.python.org/issue33238 |
| |
| Fix the test by not using the future from SequentialExecutor, and instead |
| creating a future which doesn't have a result. |
| --- |
| tests/unit/test_s3transfer.py | 2 +- |
| 1 file changed, 1 insertion(+), 1 deletion(-) |
| |
| diff --git a/tests/unit/test_s3transfer.py b/tests/unit/test_s3transfer.py |
| index a87b4dd..4715be2 100644 |
| --- a/tests/unit/test_s3transfer.py |
| +++ b/tests/unit/test_s3transfer.py |
| @@ -465,7 +465,7 @@ def __init__(self, max_workers): |
| self.is_first = True |
| |
| def submit(self, function): |
| - future = super(FailedDownloadParts, self).submit(function) |
| + future = futures.Future() |
| if self.is_first: |
| # This is the download_parts_thread. |
| future.set_exception( |