Permalink
Browse files

Bug 793892 - Update Mutt tests so they clean-up temporary test files.…

… r=hskupin r=dhunt
  • Loading branch information...
1 parent de52200 commit 2b0fcbe481ca9d5980cd4d067ada2e2760b66302 @ffledgling ffledgling committed with davehunt Feb 14, 2013
@@ -22,10 +22,11 @@ def make_test(self):
def test_JSON_structure(self):
passes = 1
- path = self.make_test()
+ self.path = self.make_test()
+ print self.path
m = mozmill.MozMill.create()
- m.run([dict(path=path)])
+ m.run([dict(path=self.path)])
results = m.finish()
# no modules pass
@@ -43,5 +44,8 @@ def test_JSON_structure(self):
self.assertTrue('exception' in failure)
self.assertTrue(fails['name'] == '<TOP_LEVEL>')
+ def tearDown(self):
+ os.remove(self.path)
+
if __name__ == '__main__':
unittest.main()
@@ -4,6 +4,7 @@
import manifestparser
import mozmill
+
class ModuleEndTest(unittest.TestCase):
"""Bug 771517: User restart tests do no longer report final test result"""
def test_modules(self):
@@ -18,13 +18,16 @@ def make_test(self):
return path
def test_logger_listener(self):
- tests = [{'path': self.make_test()}]
+ self.path = self.make_test()
+ tests = [{'path': self.path}]
- info_data= StringIO()
+ info_data = StringIO()
debug_data = StringIO()
- logger_info = LoggerListener(console_level="INFO", console_stream=info_data)
- logger_debug = LoggerListener(console_level="DEBUG", console_stream=debug_data)
+ logger_info = LoggerListener(console_level="INFO",
+ console_stream=info_data)
+ logger_debug = LoggerListener(console_level="DEBUG",
+ console_stream=debug_data)
m = mozmill.MozMill.create(handlers=[logger_info, logger_debug])
m.run(tests)
@@ -38,5 +41,8 @@ def test_logger_listener(self):
assert "TEST-PASS" in debug_data.getvalue()
assert "DEBUG" not in info_data.getvalue()
+ def tearDown(self):
+ os.remove(self.path)
+
if __name__ == '__main__':
unittest.main()
@@ -23,8 +23,9 @@ def do_test(self, relative_test_path):
relative_test_path)
tests = [{'path': testpath}]
- info_data= StringIO()
- logger = LoggerListener(console_level="DEBUG", console_stream=info_data)
+ info_data = StringIO()
+ logger = LoggerListener(console_level="DEBUG",
+ console_stream=info_data)
m = mozmill.MozMill.create(handlers=[logger])
m.run(tests)
@@ -38,10 +39,14 @@ def do_test(self, relative_test_path):
return results
def test_modules(self):
- results = self.do_test(self.make_test())
+ self.path = self.make_test()
+ results = self.do_test(self.path)
self.assertEqual(sys.getrefcount(results), 2,
"Only a single reference to results exists")
+ def tearDown(self):
+ os.remove(self.path)
+
if __name__ == '__main__':
unittest.main()
@@ -19,13 +19,15 @@ def make_test(self):
def test_api(self):
passes = 1
- path = self.make_test()
+ self.path = self.make_test()
m = mozmill.MozMill.create()
- m.run([dict(path=path)])
+ m.run([dict(path=self.path)])
results = m.finish()
-
self.assertTrue(len(results.passes) == passes)
+ def tearDown(self):
+ os.remove(self.path)
+
if __name__ == '__main__':
unittest.main()
@@ -19,14 +19,17 @@ def make_test(self):
def test_runtwice(self):
passes = 2
- path = self.make_test()
+ self.path = self.make_test()
m = mozmill.MozMill.create()
- m.run([dict(path=path)])
- m.run([dict(path=path)])
+ m.run([dict(path=self.path)])
+ m.run([dict(path=self.path)])
results = m.finish()
self.assertTrue(len(results.passes) == passes)
+ def tearDown(self):
+ os.remove(self.path)
+
if __name__ == '__main__':
unittest.main()
@@ -32,25 +32,25 @@ def make_test(self, shutdown=''):
return path
def test_persisted(self):
- path = self.make_test()
+ self.path = self.make_test()
m = mozmill.MozMill.create()
m.persisted['bar'] = 'foo'
m.persisted['foo'] = 'bar'
m.persisted['number'] = 1
- m.run([dict(path=path)])
+ m.run([dict(path=self.path)])
results = m.finish()
self.assertTrue(len(results.passes) == 1)
self.inspect_persisted(m.persisted)
def test_persisted_shutdown(self):
- path = self.make_test(shutdown='controller.stopApplication();')
+ self.path = self.make_test(shutdown='controller.stopApplication();')
m = mozmill.MozMill.create()
m.persisted['bar'] = 'foo'
m.persisted['foo'] = 'bar'
m.persisted['number'] = 1
- m.run([dict(path=path)])
+ m.run([dict(path=self.path)])
results = m.finish()
self.assertTrue(len(results.passes) == 1)
@@ -62,5 +62,8 @@ def inspect_persisted(self, persisted):
u'bar': u'bar',
u'number': 2})
+ def tearDown(self):
+ os.remove(self.path)
+
if __name__ == '__main__':
unittest.main()

0 comments on commit 2b0fcbe

Please sign in to comment.