summaryrefslogtreecommitdiff
blob: 89f3d4b5ab32ff83b6c8c662a22239ec707f610d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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(