зеркало из https://github.com/mozilla/gecko-dev.git
Bug 776035 - Make mozunit even easier to use, and use it in config/tests python unit tests. r=ted
This commit is contained in:
Родитель
987cbfa2e1
Коммит
985de147d7
|
@ -3,6 +3,7 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from unittest import TextTestRunner as _TestRunner, TestResult as _TestResult
|
||||
import unittest
|
||||
import inspect
|
||||
|
||||
'''Helper to make python unit tests report the way that the Mozilla
|
||||
|
@ -11,10 +12,10 @@ unit test infrastructure expects tests to report.
|
|||
Usage:
|
||||
|
||||
import unittest
|
||||
from mozunit import MozTestRunner
|
||||
import mozunit
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(testRunner=MozTestRunner())
|
||||
mozunit.main()
|
||||
'''
|
||||
|
||||
class _MozTestResult(_TestResult):
|
||||
|
@ -68,3 +69,6 @@ class MozTestRunner(_TestRunner):
|
|||
test(result)
|
||||
result.printErrorList()
|
||||
return result
|
||||
|
||||
def main(*args):
|
||||
unittest.main(testRunner=MozTestRunner(),*args)
|
||||
|
|
|
@ -2,7 +2,7 @@ import unittest
|
|||
|
||||
import sys
|
||||
import os.path
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import mozunit
|
||||
|
||||
from Expression import Expression, Context
|
||||
|
||||
|
@ -60,4 +60,4 @@ class TestExpression(unittest.TestCase):
|
|||
self.assert_(Expression('FAIL != 1').evaluate(self.c))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
mozunit.main()
|
||||
|
|
|
@ -5,9 +5,7 @@ from filecmp import dircmp
|
|||
from tempfile import mkdtemp
|
||||
from shutil import rmtree, copy2
|
||||
from zipfile import ZipFile
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
||||
from mozunit import MozTestRunner
|
||||
import mozunit
|
||||
from JarMaker import JarMaker
|
||||
|
||||
if sys.platform == "win32":
|
||||
|
@ -280,4 +278,4 @@ class TestJarMaker(unittest.TestCase):
|
|||
self.assertTrue(not difference, difference)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(testRunner=MozTestRunner())
|
||||
mozunit.main()
|
||||
|
|
|
@ -4,7 +4,7 @@ from StringIO import StringIO
|
|||
import os
|
||||
import sys
|
||||
import os.path
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import mozunit
|
||||
|
||||
from Preprocessor import Preprocessor
|
||||
|
||||
|
@ -43,4 +43,4 @@ class TestLineEndings(unittest.TestCase):
|
|||
self.assertEquals(self.pp.out.getvalue(), 'a\nb\nc\n')
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
mozunit.main()
|
||||
|
|
|
@ -5,7 +5,7 @@ from StringIO import StringIO
|
|||
import os
|
||||
import sys
|
||||
import os.path
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import mozunit
|
||||
|
||||
from Preprocessor import Preprocessor
|
||||
|
||||
|
@ -592,4 +592,4 @@ barfoobaz
|
|||
""")
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
mozunit.main()
|
||||
|
|
|
@ -3,7 +3,7 @@ import unittest
|
|||
import os, sys, os.path, time
|
||||
from tempfile import mkdtemp
|
||||
from shutil import rmtree
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import mozunit
|
||||
|
||||
from buildlist import addEntriesToListFile
|
||||
|
||||
|
@ -77,4 +77,4 @@ class TestBuildList(unittest.TestCase):
|
|||
self.assertFileContains(testfile, ["a","b","c"])
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
mozunit.main()
|
||||
|
|
|
@ -6,8 +6,7 @@ import os
|
|||
import imp
|
||||
from tempfile import mkdtemp
|
||||
from shutil import rmtree
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
from mozunit import MozTestRunner
|
||||
import mozunit
|
||||
|
||||
from UserString import UserString
|
||||
# Create a controlled configuration for use by expandlibs
|
||||
|
@ -385,4 +384,4 @@ class TestSymbolOrder(unittest.TestCase):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(testRunner=MozTestRunner())
|
||||
mozunit.main()
|
||||
|
|
|
@ -3,7 +3,7 @@ import unittest
|
|||
import os, sys, os.path, time
|
||||
from tempfile import mkdtemp
|
||||
from shutil import rmtree
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import mozunit
|
||||
from mozprocess import processhandler
|
||||
|
||||
from nsinstall import nsinstall
|
||||
|
@ -170,4 +170,4 @@ class TestNsinstall(unittest.TestCase):
|
|||
#TODO: implement -R, -l, -L and test them!
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
mozunit.main()
|
||||
|
|
|
@ -2,7 +2,7 @@ import unittest
|
|||
|
||||
import sys
|
||||
import os.path
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import mozunit
|
||||
|
||||
from printprereleasesuffix import get_prerelease_suffix
|
||||
|
||||
|
@ -77,4 +77,4 @@ class TestGetPreReleaseSuffix(unittest.TestCase):
|
|||
self.assertEqual(self.c, '')
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
mozunit.main()
|
||||
|
|
|
@ -3,8 +3,7 @@ from __future__ import with_statement
|
|||
import unittest
|
||||
import os, sys, time, tempfile
|
||||
from StringIO import StringIO
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import mozunit
|
||||
|
||||
from writemozinfo import build_dict, write_json, JsonValue, jsonify
|
||||
|
||||
|
@ -239,5 +238,4 @@ class TestWriteJson(unittest.TestCase):
|
|||
self.assertEqual(32, d['bits'])
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
mozunit.main()
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#
|
||||
# Unit tests for xpidl.py
|
||||
|
||||
import mozunit
|
||||
import unittest
|
||||
import xpidl
|
||||
|
||||
|
@ -94,4 +95,4 @@ attribute long bar;
|
|||
self.assertEqual("long", a.type)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
mozunit.main()
|
||||
|
|
|
@ -37,6 +37,7 @@ from StringIO import StringIO
|
|||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import mozunit
|
||||
import unittest
|
||||
import xpt
|
||||
|
||||
|
@ -763,4 +764,4 @@ class TestXPTLink(unittest.TestCase):
|
|||
t3.interfaces[0].methods[0].params[0].type.element_type.iface)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
mozunit.main()
|
||||
|
|
Загрузка…
Ссылка в новой задаче