We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
update()
1 parent b3b0846 commit 4b39d29Copy full SHA for 4b39d29
templateflow/tests/test_multiproc.py
@@ -0,0 +1,27 @@
1
+import os
2
+from concurrent.futures import ProcessPoolExecutor
3
+
4
+import pytest
5
6
+CPUs = os.cpu_count() or 1
7
8
9
+def _update():
10
+ from templateflow.conf import update
11
12
+ update(local=False, overwrite=True, silent=True)
13
+ return True
14
15
16
+@pytest.mark.skipif(CPUs < 2, reason='At least 2 CPUs are required')
17
+def test_multi_proc_update(tmp_path, monkeypatch):
18
+ tf_home = tmp_path / 'tf_home'
19
+ monkeypatch.setenv('TEMPLATEFLOW_HOME', str(tf_home))
20
21
+ futs = []
22
+ with ProcessPoolExecutor(max_workers=2) as executor:
23
+ for _ in range(2):
24
+ futs.append(executor.submit(_update))
25
26
+ for fut in futs:
27
+ assert fut.result()
0 commit comments