Conditionally removed Windows multiprocessing reference

This commit is contained in:
Julien Kauffmann 2015-05-14 16:48:14 -04:00
parent 79c3087aa5
commit ea2c9407d3
1 changed files with 9 additions and 2 deletions

View File

@ -1,11 +1,14 @@
import logging import logging
import multiprocessing
import operator import operator
import os import os
import re import re
import termcolor import termcolor
import timeit import timeit
# Windows and Python 2.7 multiprocessing don't marry well.
if os.name != 'nt':
import multiprocessing
from nose.plugins import Plugin from nose.plugins import Plugin
log = logging.getLogger('nose.plugin.timer') log = logging.getLogger('nose.plugin.timer')
@ -21,7 +24,11 @@ class TimerPlugin(Plugin):
def __init__(self): def __init__(self):
super(TimerPlugin, self).__init__() super(TimerPlugin, self).__init__()
self._timed_tests = multiprocessing.Manager().dict()
if os.name != 'nt':
self._timed_tests = multiprocessing.Manager().dict()
else:
self._timed_tests = {}
def _time_taken(self): def _time_taken(self):
if hasattr(self, '_timer'): if hasattr(self, '_timer'):