summaryrefslogtreecommitdiff
path: root/nose
diff options
context:
space:
mode:
authorJason Pellerin <jpellerin@gmail.com>2009-05-09 14:56:24 -0400
committerJason Pellerin <jpellerin@gmail.com>2009-05-09 14:56:24 -0400
commitc2ab398582dc0319c67a5fe1a4637791d6004321 (patch)
tree72a46c12e2520e4352bf03e22e37b395fb6348fb /nose
parentdd5905b1563055aec5b6157021db7bd309d34d3a (diff)
downloadnose-c2ab398582dc0319c67a5fe1a4637791d6004321.tar.gz
Working on making config pickleable to support mp on windows
Diffstat (limited to 'nose')
-rw-r--r--nose/config.py12
-rw-r--r--nose/plugins/logcapture.py10
-rw-r--r--nose/plugins/manager.py6
-rw-r--r--nose/plugins/prof.py3
4 files changed, 28 insertions, 3 deletions
diff --git a/nose/config.py b/nose/config.py
index 672e85c..080ccab 100644
--- a/nose/config.py
+++ b/nose/config.py
@@ -211,6 +211,15 @@ class Config(object):
self.update(kw)
self._orig = self.__dict__.copy()
+ def __getstate__(self):
+ state = self.__dict__.copy()
+ del state['stream']
+ del state['_orig']
+ del state['_default']
+ del state['env']
+ del state['logStream']
+ return state
+
def __repr__(self):
d = self.__dict__.copy()
# don't expose env, could include sensitive info
@@ -530,6 +539,9 @@ class Config(object):
class NoOptions(object):
"""Options container that returns None for all options.
"""
+ def __getstate__(self):
+ return {}
+
def __getattr__(self, attr):
return None
diff --git a/nose/plugins/logcapture.py b/nose/plugins/logcapture.py
index 7060aa4..9558962 100644
--- a/nose/plugins/logcapture.py
+++ b/nose/plugins/logcapture.py
@@ -17,6 +17,7 @@ You can remove other installed logging handlers with the
import logging
from logging.handlers import BufferingHandler
+import threading
from nose.plugins.base import Plugin
from nose.util import ln, safe_str
@@ -52,8 +53,13 @@ class MyMemoryHandler(BufferingHandler):
if rname == name or rname.startswith(name+'.'):
matched = True
return matched
-
-
+ def __getstate__(self):
+ state = self.__dict__.copy()
+ del state['lock']
+ def __setstate__(self, state):
+ self.__dict__.update(state)
+ self.lock = threading.RLock()
+
class LogCapture(Plugin):
"""
Log capture plugin. Enabled by default. Disable with --nologcapture.
diff --git a/nose/plugins/manager.py b/nose/plugins/manager.py
index 0b0ee2a..4f1c9e4 100644
--- a/nose/plugins/manager.py
+++ b/nose/plugins/manager.py
@@ -277,7 +277,11 @@ class PluginManager(object):
"""Access the list of plugins managed by
this plugin manager""")
-
+ def __getstate__(self):
+ state = self.__dict__.copy()
+ del state['_proxies']
+ return state
+
class ZeroNinePlugin:
"""Proxy for 0.9 plugins, adapts 0.10 calls to 0.9 standard.
"""
diff --git a/nose/plugins/prof.py b/nose/plugins/prof.py
index 7ea9f03..729d1e0 100644
--- a/nose/plugins/prof.py
+++ b/nose/plugins/prof.py
@@ -152,3 +152,6 @@ class Profile(Plugin):
if not self.pfile:
self.fileno, self.pfile = tempfile.mkstemp()
self.clean_stats_file = True
+
+ def __getstate__(self):
+ return {}