Browse Source

Detect number of CPU cores for faster testing

Faster tests are faster.
master
Maik Hoepfel 12 years ago
parent
commit
27c0dc0370
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      runtests.py

+ 6
- 1
runtests.py View File

@@ -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

Loading…
Cancel
Save