~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

Catch more specific exceptions in local_concurrency().

Show diffs side-by-side

added added

removed removed

Lines of Context:
3063
3063
        content = file('/proc/cpuinfo', 'rb').read()
3064
3064
        concurrency = cpucount(content)
3065
3065
        return concurrency
3066
 
    except Exception, e:
 
3066
    except IOError:
3067
3067
        pass
3068
3068
 
3069
3069
    try:
3070
 
       output = Popen(['sysctl', '-n', 'hw.availcpu'], stdout=PIPE).communicate()[0]
 
3070
       output = Popen(['sysctl', '-n', 'hw.availcpu'],
 
3071
                      stdout=PIPE).communicate()[0]
3071
3072
       concurrency = int(output)
3072
3073
       return concurrency
3073
 
    except Exception, e:
 
3074
    except (OSError, IOError):
3074
3075
        concurrency = 1
3075
3076
 
3076
3077
    return concurrency