summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorjvoisin2019-11-30 09:57:18 +0100
committerjvoisin2019-11-30 10:10:41 +0100
commit6e52661cfb4e79a76a6ff80637d5adf495a15479 (patch)
tree345f3002a0437eb2f5d3289ecd1441169002ccf3 /tests
parent03f5129968a19de26945f5236da70553ada04620 (diff)
Fix the testsuite on Python3.8
There is a bug in Python3.8 (https://bugs.python.org/issue38688) triggering an infinite recursion when copying a tree in a subfolder of the current one. We're working around it by using a list instead of an iterator, so that Python won't "discover" the target folder as part of the source files. This should fix #130
Diffstat (limited to 'tests')
-rw-r--r--tests/test_climat2.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/test_climat2.py b/tests/test_climat2.py
index 17fce82..da790d0 100644
--- a/tests/test_climat2.py
+++ b/tests/test_climat2.py
@@ -1,3 +1,4 @@
1import sys
1import random 2import random
2import os 3import os
3import shutil 4import shutil
@@ -258,7 +259,16 @@ class TestCommandLineParallel(unittest.TestCase):
258 os.remove(path) 259 os.remove(path)
259 260
260 def test_different(self): 261 def test_different(self):
261 shutil.copytree('./tests/data/', './tests/data/parallel') 262 src = './tests/data/'
263 dst = './tests/data/parallel'
264 if sys.version_info >= (3, 8):
265 with os.scandir(src) as itr:
266 entries = list(itr)
267 shutil._copytree(entries=entries, src=src, dst=dst, symlinks=False,
268 ignore=None, copy_function=shutil.copy2,
269 ignore_dangling_symlinks=False)
270 else:
271 shutil.copytree(src, dst)
262 272
263 proc = subprocess.Popen(mat2_binary + glob.glob('./tests/data/parallel/dirty.*'), 273 proc = subprocess.Popen(mat2_binary + glob.glob('./tests/data/parallel/dirty.*'),
264 stdout=subprocess.PIPE) 274 stdout=subprocess.PIPE)