Browse Source

don't execute a test if less of 2 cpus

Bastien Sevajol 7 years ago
parent
commit
9d22a373fc
1 changed files with 6 additions and 2 deletions
  1. 6 2
      tests/test_processing.py

+ 6 - 2
tests/test_processing.py View File

1
 # coding: utf-8
1
 # coding: utf-8
2
 import os
2
 import os
3
 
3
 
4
+import multiprocessing
5
+import pytest
6
+
4
 from synergine2.processing import ProcessManager
7
 from synergine2.processing import ProcessManager
5
 from synergine2.utils import ChunkManager
8
 from synergine2.utils import ChunkManager
6
 from tests import BaseTest
9
 from tests import BaseTest
33
         result = sum(data)
36
         result = sum(data)
34
         return current_pid, MyFakeClass(result)
37
         return current_pid, MyFakeClass(result)
35
 
38
 
39
+    @pytest.mark.skipif(multiprocessing.cpu_count() < 2, reason="requires 2 or more cpus")
36
     def test_parallel_jobs_with_scalar(self):
40
     def test_parallel_jobs_with_scalar(self):
37
-        chunk_manager = ChunkManager(4)
41
+        chunk_manager = ChunkManager(2)
38
         process_manager = ProcessManager(
42
         process_manager = ProcessManager(
39
-            process_count=4,
43
+            process_count=2,
40
             chunk_manager=chunk_manager,
44
             chunk_manager=chunk_manager,
41
         )
45
         )
42
 
46