Beispiel #1
0
    def test_collect_one_suite(self):
        expect_suite_name = 'test.test_suite_name'
        expect_suite = Suite(expect_suite_name)
        argv = ['test', expect_suite_name, '--with-app-configure']

        suites = [Suite(__name__) for _ in xrange(9)] + [expect_suite]

        app = NoseApp()
        app.register_suites(suites)

        program = TestProgram(
            app=app,
            argv=argv,
            plugins=[AppConfigurePlugin()],
        )

        collector = CollectSuite(program.data)
        result = collector.make_result()

        self.assertIsInstance(result, ContextSuite)

        result = [s for s in result]

        self.assertEqual(len(result), 1)

        for suite in result:
            self.assertIsInstance(suite, ContextSuite)
Beispiel #2
0
    def test_collect_one_case_method(self):

        class NewFakeTestCase(FakeTestCase):

            def test_(self):
                pass

        expect_case_name = NewFakeTestCase.__name__
        expect_suite_name = 'test_suite_name.test'

        argv = [
            'test',
            '{}:{}'.format(expect_suite_name, expect_case_name),
            '--with-app-configure'
        ]

        expect_suite = Suite(expect_suite_name)
        expect_suite.register(NewFakeTestCase)
        expect_suite.register(NoseAppTestCase)

        suites = [Suite(__name__) for _ in xrange(9)] + [expect_suite]

        app = NoseApp()
        app.register_suites(suites)

        program = TestProgram(
            app=app,
            argv=argv,
            plugins=[AppConfigurePlugin()],
        )

        collector = CollectSuite(program.data)
        result = collector.make_result()

        self.assertIsInstance(result, ContextSuite)

        result = [s for s in result]

        self.assertEqual(len(result), 1)

        for suite in result:
            self.assertIsInstance(suite, ContextSuite)

            for test in suite:
                self.assertIsInstance(test.test, FakeTestCase)