Skip to content

Commit

Permalink
The Windows problems seem to be ultimately caused by test modules the…
Browse files Browse the repository at this point in the history
…mselves getting attached to the test result object...somewhere. Whitelisting what gets pickled in __getstate__ seems to have FINALLY solved it on my Windows VMs. Hopefully the Appveyor builders agree...
  • Loading branch information
CleanCut committed Jul 23, 2015
1 parent cdb804d commit 1ff5750
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
16 changes: 16 additions & 0 deletions green/process.py
Expand Up @@ -18,6 +18,22 @@



# Super-useful debug function for finding problems in the subprocesses, and it
# even works on windows
def ddebug(msg, err=None): # pragma: no cover
"""
err can be an instance of sys.exc_info() -- which is the latest traceback
info
"""
if err:
err = ''.join(traceback.format_exception(*err))
else:
err = ''
sys.__stdout__.write("({}) {} {}".format(os.getpid(), msg, err)+'\n')
sys.__stdout__.flush()



class ProcessLogger(object):
"""I am used by LoggingDaemonlessPool to get crash output out to the
logger, instead of having process crashes be silent"""
Expand Down
20 changes: 16 additions & 4 deletions green/result.py
Expand Up @@ -164,6 +164,18 @@ def __init__(self, start_callback=None, stop_callback=None):
super(ProtoTestResult, self).__init__(None, None)
self.start_callback = start_callback
self.stop_callback = stop_callback
self.pickle_attrs = [
'errors',
'expectedFailures',
'failures',
'passing',
'pickle_attrs',
'shouldStop',
'skipped',
'stderr_errput',
'stdout_output',
'unexpectedSuccesses',
]
self.reinitialize()


Expand All @@ -190,10 +202,10 @@ def __repr__(self): # pragma: no cover

def __getstate__(self):
"Prevent the callback functions from getting pickled"
clean_dict = self.__dict__.copy()
del clean_dict['start_callback']
del clean_dict['stop_callback']
return clean_dict
result_dict = {}
for pickle_attr in self.pickle_attrs:
result_dict[pickle_attr] = self.__dict__[pickle_attr]
return result_dict


def __setstate__(self, dict):
Expand Down

0 comments on commit 1ff5750

Please sign in to comment.