summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarry Kao <harry@nextdoor.com>2015-12-22 14:09:45 -0800
committerHarry Kao <harry@nextdoor.com>2015-12-22 14:09:45 -0800
commit02f7d848e4924264f81d3753673db53a93ae1c13 (patch)
tree00ba0b2746d1820d3ed6319b0faf150a0e88c67e
parent0f592c4b022bf3226bd970ccc8c09fea899b2960 (diff)
downloadnose-02f7d848e4924264f81d3753673db53a93ae1c13.tar.gz
Use a new test loader for each queue item.
The loader's ContextSuiteFactory keeps a reference to all of the test suites, even after they've been run, which consumes more and more memory over time. This change creates a new loader for each suite that's dispatched to the worker, which allows the GC to free the old test suites.
-rw-r--r--nose/plugins/multiprocess.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/nose/plugins/multiprocess.py b/nose/plugins/multiprocess.py
index 2cae744..135d69c 100644
--- a/nose/plugins/multiprocess.py
+++ b/nose/plugins/multiprocess.py
@@ -668,8 +668,6 @@ def __runner(ix, testQueue, resultQueue, currentaddr, currentstart,
config.plugins.configure(config.options,config)
config.plugins.begin()
log.debug("Worker %s executing, pid=%d", ix,os.getpid())
- loader = loaderClass(config=config)
- loader.suiteClass.suiteClass = NoSharedFixtureContextSuite
def get():
return testQueue.get(timeout=config.multiprocess_timeout)
@@ -702,6 +700,8 @@ def __runner(ix, testQueue, resultQueue, currentaddr, currentstart,
log.exception('Worker %d STOPPED',ix)
break
result = makeResult()
+ loader = loaderClass(config=config)
+ loader.suiteClass.suiteClass = NoSharedFixtureContextSuite
test = loader.loadTestsFromNames([test_addr])
test.testQueue = testQueue
test.tasks = []