Skip to content

Commit

Permalink
Fix/remove a couple comments. Fixed ProtoTestResult so that it's pick…
Browse files Browse the repository at this point in the history
…leable again [ this one-liner cost me about 4-5 hours :-( ]. Switched back to pool.close() to fix the pypy hangs on Linux (hopefully) and pypy dangling processes on OS X. Instantiate the multiprocessing manager once, instead of for every single test chunk.
  • Loading branch information
CleanCut committed Jul 22, 2015
1 parent 037a03c commit 82b3c8f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion green/process.py
Expand Up @@ -234,7 +234,6 @@ def stop_callback(test_result):
# Let the main process know what happened with the test run
queue.put(test_result)

# Create a structure to return the results of this one test
result = ProtoTestResult(start_callback, stop_callback)
test = None
try:
Expand Down
3 changes: 2 additions & 1 deletion green/result.py
Expand Up @@ -88,7 +88,7 @@ def getDescription(self, verbose):

class ProtoError():
"""I take a full-fledged test error and preserve just the information we
need and can bass between processes.
need and can pass between processes.
"""
def __init__(self, err=None):
self.traceback_lines = traceback.format_exception(*err)
Expand Down Expand Up @@ -207,6 +207,7 @@ def startTest(self, test):
"Called before each test runs"
# I can't quite figure out the exact reason tests get double-started in
# test_uncaughtException, but this fixes it
test = proto_test(test)
if test == self.current_test:
# Don't double-start a test
return
Expand Down
5 changes: 3 additions & 2 deletions green/runner.py
Expand Up @@ -92,7 +92,8 @@ def run(suite, stream, args):
pool = LoggingDaemonlessPool(processes=args.processes or None,
initializer=InitializerOrFinalizer(args.initializer),
finalizer=InitializerOrFinalizer(args.finalizer))
tests = [_AsyncChunk(t, multiprocessing.Manager().Queue()) for t in toParallelTestTargets(suite, args.targets)]
manager = multiprocessing.Manager()
tests = [_AsyncChunk(t, manager.Queue()) for t in toParallelTestTargets(suite, args.targets)]
if tests:
for index, test_chunk in enumerate(tests):
if args.run_coverage:
Expand Down Expand Up @@ -127,7 +128,7 @@ def run(suite, stream, args):
if abort_tests:
break

pool.terminate()
pool.close()
pool.join()

result.stopTestRun()
Expand Down

0 comments on commit 82b3c8f

Please sign in to comment.