Просмотр исходного кода

Detect number of CPU cores for faster testing

Faster tests are faster.
master
Maik Hoepfel 12 лет назад
Родитель
Сommit
27c0dc0370
1 измененных файлов: 6 добавлений и 1 удалений
  1. 6
    1
      runtests.py

+ 6
- 1
runtests.py Просмотреть файл

@@ -21,7 +21,12 @@ if __name__ == '__main__':
21 21
     args = sys.argv[1:]
22 22
 
23 23
     if not args:
24
-        args = ['-s', '-x', '--processes=4']
24
+        import multiprocessing
25
+        try:
26
+            num_cores = multiprocessing.cpu_count()
27
+        except NotImplementedError:
28
+            num_cores = 4
29
+        args = ['-s', '-x', '--processes=%s' % num_cores]
25 30
     else:
26 31
         # Some args specified.  Check to see if any nose options have been
27 32
         # specified.  If they have, then don't set any

Загрузка…
Отмена
Сохранить