This repository has been archived by the owner on Aug 20, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 761564 - Memory leaks in Mozmill Python code which keeps referenc…
…es around and never completely releases the Mozmill object. r=jhammel, r=ctalbert
- Loading branch information
Showing
13 changed files
with
158 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,47 @@ | |||
from cStringIO import StringIO | |||
import os | |||
import sys | |||
import tempfile | |||
import unittest | |||
|
|||
import mozmill | |||
from mozmill.logger import LoggerListener | |||
|
|||
|
|||
class ModuleTest(unittest.TestCase): | |||
def make_test(self): | |||
"""make an example test to run""" | |||
test = """var test_something = function() {}""" | |||
fd, path = tempfile.mkstemp() | |||
os.write(fd, test) | |||
os.close(fd) | |||
|
|||
return path | |||
|
|||
def do_test(self, relative_test_path): | |||
testpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), | |||
relative_test_path) | |||
tests = [{'path': testpath}] | |||
|
|||
info_data= StringIO() | |||
logger = LoggerListener(console_level="DEBUG", console_stream=info_data) | |||
|
|||
m = mozmill.MozMill.create(handlers=[logger]) | |||
m.run(tests) | |||
results = m.finish() | |||
|
|||
self.assertEqual(sys.getrefcount(logger), 2, | |||
"Only a single reference to the logger exists") | |||
self.assertEqual(sys.getrefcount(m), 2, | |||
"Only a single reference to mozmill exists") | |||
|
|||
return results | |||
|
|||
def test_modules(self): | |||
results = self.do_test(self.make_test()) | |||
|
|||
self.assertEqual(sys.getrefcount(results), 2, | |||
"Only a single reference to results exists") | |||
|
|||
if __name__ == '__main__': | |||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.