def test_decorateTestSuite(self):
     """
     Calling L{decorate} on a test suite will return a test suite with
     each test decorated with the provided decorator.
     """
     test = self.TestCase()
     suite = unittest.TestSuite([test])
     decoratedTest = unittest.decorate(suite, unittest.TestDecorator)
     self.assertSuitesEqual(
         decoratedTest, unittest.TestSuite([unittest.TestDecorator(test)]))
 def test_decorateInPlaceMutatesOriginal(self):
     """
     Calling L{decorate} on a test suite will mutate the original suite.
     """
     test = self.TestCase()
     suite = unittest.TestSuite([test])
     decoratedTest = unittest.decorate(suite, unittest.TestDecorator)
     self.assertSuitesEqual(
         decoratedTest, unittest.TestSuite([unittest.TestDecorator(test)]))
     self.assertSuitesEqual(
         suite, unittest.TestSuite([unittest.TestDecorator(test)]))
 def test_decorateNestedTestSuite(self):
     """
     Calling L{decorate} on a test suite with nested suites will return a
     test suite that maintains the same structure, but with all tests
     decorated.
     """
     test = self.TestCase()
     suite = unittest.TestSuite([unittest.TestSuite([test])])
     decoratedTest = unittest.decorate(suite, unittest.TestDecorator)
     expected = unittest.TestSuite(
         [unittest.TestSuite([unittest.TestDecorator(test)])])
     self.assertSuitesEqual(decoratedTest, expected)
Ejemplo n.º 4
0
def test_suite():
    import unittest as ut
    suite = unittest.TestSuite()
    suite.addTest(ut.makeSuite(DecoratorsTest))
    suite.addTest(ut.makeSuite(APIResourceTest))
    suite.addTest(unittest.doctest.DocFileSuite(os.path.join('..', 'README.rst')))
    return suite
Ejemplo n.º 5
0
def test_suite():
    """
    Generate a test suite from the fixture directory.
    """
    path = filepath.FilePath(__file__).parent().child('aws4_testsuite').child(
        'aws4_testsuite')

    methods = {}
    for fixture_path in _collect_fixture_directories(path):
        method = _build_test_method(path, fixture_path)
        methods[method.__name__] = method

    suite = unittest.TestSuite()
    suite.name = "test_aws4_testsuite"

    test_class = type(
        "AWS4TestSuiteTestCase",
        (_AWS4TestSuiteTestCaseMixin, unittest.SynchronousTestCase), methods)
    for method_name in sorted(methods):
        test = test_class(method_name)
        suite.addTest(test)

    if not methods:
        empty_tests = test_class()
        empty_tests.skip = "Missing AWS test suite directory: {}".format(
            path.path)
        suite.addTest(empty_tests)

    return suite
Ejemplo n.º 6
0
def test_suite():
    import warnings
    msg = 'These tests will be removed in a future release of the txrestserver'
    warnings.warn(msg, DeprecationWarning)

    import unittest as ut
    suite = unittest.TestSuite()
    suite.addTest(ut.makeSuite(DecoratorsTest))
    suite.addTest(ut.makeSuite(APIResourceTest))
    return suite
 def test_clearSuite(self):
     """
     Calling L{_clearSuite} on a populated L{TestSuite} removes
     all tests.
     """
     suite = unittest.TestSuite()
     suite.addTest(self.TestCase())
     # Double check that the test suite actually has something in it.
     self.assertEqual(1, suite.countTestCases())
     _clearSuite(suite)
     self.assertEqual(0, suite.countTestCases())
Ejemplo n.º 8
0
def suite():
    import unittest

    suite = unittest.TestSuite()

    suite.addTest(unittest.makeSuite(TwistedServerTestCase))
    suite.addTest(unittest.makeSuite(TwistedGatewayTestCase))
    suite.addTest(unittest.makeSuite(AMF0RequestProcessorTestCase))
    suite.addTest(unittest.makeSuite(AMF3RequestProcessorTestCase))

    return suite
def suite():
    # don't use twisted.trial unittest here
    import unittest  # @Reimport
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(InterfacesTestCase, 'test'))
    suite.addTest(unittest.makeSuite(ComponentizedTestCase, 'test'))
    suite.addTest(unittest.makeSuite(AdapterTestCase, 'test'))
    suite.addTest(unittest.makeSuite(TestMetaInterface, 'test'))
    suite.addTest(unittest.makeSuite(RegistrationTestCase, 'test'))
    suite.addTest(unittest.makeSuite(ProxyForInterfaceTests, 'test'))
    return suite
Ejemplo n.º 10
0
def createHTTPTranslationsTestSuite():
    suite = unittest.TestSuite()
    translations = os.listdir(_HTTPTranslationsTests.i18n)
    translations.remove('templates')

    for locale in translations:
        klass = _HTTPTranslationsTests
        method = klass.makeTestMethod(locale)
        case = klass()
        suite.addTest(case)

    return [
        suite,
    ]
Ejemplo n.º 11
0
 def test_collectCalledWhenTearDownClass(self):
     """
     test gc.collect is called after tearDownClass.
     """
     test = unittest.TestSuite([
         TestGarbageCollection.ClassTest('test_1'),
         TestGarbageCollection.ClassTest('test_2')
     ])
     test = unittest.decorate(test,
                              unittest._ForceGarbageCollectionDecorator)
     result = reporter.TestResult()
     test.run(result)
     # check that collect gets called after individual tests, and
     # after tearDownClass
     self.failUnlessEqual(self._collectCalled, [
         'collect', 'test1', 'collect', 'collect', 'test2', 'tearDownClass',
         'collect'
     ])
Ejemplo n.º 12
0
    def test_decorateTestSuiteReferences(self):
        """
        When decorating a test suite in-place, the number of references to the
        test objects in that test suite should stay the same.

        Previously, L{unittest.decorate} recreated a test suite, so the
        original suite kept references to the test objects. This test is here
        to ensure the problem doesn't reappear again.
        """
        getrefcount = getattr(sys, "getrefcount", None)
        if getrefcount is None:
            raise unittest.SkipTest("getrefcount not supported on this platform")
        test = self.TestCase()
        suite = unittest.TestSuite([test])
        count1 = getrefcount(test)
        unittest.decorate(suite, unittest.TestDecorator)
        count2 = getrefcount(test)
        self.assertEqual(count1, count2)
Ejemplo n.º 13
0
def suite():
    suite = unittest.TestSuite()
    suite.addTest(Test_02_Insteon('test_0101_ValidFamilies'))
    suite.addTest(Test_02_Insteon('test_allDefined'))
    return suite
Ejemplo n.º 14
0
from chat.test import test_parse_url
from chat.test import test_email
from chat.test import test_stress
from chat.test import test_utils
# from chat.test import test_protocol
'''Text Protocol'''
from chat.test.text_protocol import test_user
from chat.test.text_protocol import test_channel
from chat.test.text_protocol import test_channel_mode
from chat.test.text_protocol import test_channel_ban
from chat.test.text_protocol import test_channel_search
from chat.test.text_protocol import test_post

if __name__ == '__main__':
    results = reporter.TreeReporter()
    suite = unittest.TestSuite()

    tests = [
        # test_email,
        # test_protocol,
        # test_channel_search
        # test_post
        # test_parse_url,
        # test_stress,
        # test_utils,
        test_user
        # test_channel_mode,
        # test_channel,
        # test_channel_ban
    ]
Ejemplo n.º 15
0
def suite():
    suite = unittest.TestSuite()
    # suite.addTest(Test_02_API('test_0202_Init'))
    return suite
Ejemplo n.º 16
0
def testSuite():
    return unittest.TestSuite(map(lambda x: x(), testCases))