コード例 #1
0
ファイル: setup.py プロジェクト: johnko/mongo-python-driver
    def run(self):
        # Installing required packages, running egg_info and build_ext are
        # part of normal operation for setuptools.command.test.test
        if self.distribution.install_requires:
            self.distribution.fetch_build_eggs(
                self.distribution.install_requires)
        if self.distribution.tests_require:
            self.distribution.fetch_build_eggs(self.distribution.tests_require)
        self.run_command('egg_info')
        build_ext_cmd = self.reinitialize_command('build_ext')
        build_ext_cmd.inplace = 1
        self.run_command('build_ext')

        # Construct a TextTestRunner directly from the unittest imported from
        # test (this will be unittest2 under Python 2.6), which creates a
        # TestResult that supports the 'addSkip' method. setuptools will by
        # default create a TextTestRunner that uses the old TestResult class,
        # resulting in DeprecationWarnings instead of skipping tests under 2.6.
        from test import unittest, PymongoTestRunner, test_cases
        if self.test_suite is None:
            all_tests = unittest.defaultTestLoader.discover(self.test_module)
            suite = unittest.TestSuite()
            suite.addTests(sorted(test_cases(all_tests),
                                  key=lambda x: x.__module__))
        else:
            suite = unittest.defaultTestLoader.loadTestsFromName(
                self.test_suite)
        result = PymongoTestRunner(verbosity=2,
                                   failfast=self.failfast).run(suite)
        sys.exit(not result.wasSuccessful())
コード例 #2
0
    def run(self):
        # Installing required packages, running egg_info and build_ext are
        # part of normal operation for setuptools.command.test.test
        if self.distribution.install_requires:
            self.distribution.fetch_build_eggs(
                self.distribution.install_requires)
        if self.distribution.tests_require:
            self.distribution.fetch_build_eggs(self.distribution.tests_require)
        self.run_command('egg_info')
        build_ext_cmd = self.reinitialize_command('build_ext')
        build_ext_cmd.inplace = 1
        self.run_command('build_ext')

        # Construct a TextTestRunner directly from the unittest imported from
        # test (this will be unittest2 under Python 2.6), which creates a
        # TestResult that supports the 'addSkip' method. setuptools will by
        # default create a TextTestRunner that uses the old TestResult class,
        # resulting in DeprecationWarnings instead of skipping tests under 2.6.
        from test import unittest, PymongoTestRunner, test_cases
        if self.test_suite is None:
            all_tests = unittest.defaultTestLoader.discover(self.test_module)
            suite = unittest.TestSuite()
            suite.addTests(
                sorted(test_cases(all_tests), key=lambda x: x.__module__))
        else:
            suite = unittest.defaultTestLoader.loadTestsFromName(
                self.test_suite)
        result = PymongoTestRunner(verbosity=2,
                                   failfast=self.failfast).run(suite)
        sys.exit(not result.wasSuccessful())
コード例 #3
0
ファイル: setup.py プロジェクト: pks-os/mongo-python-driver
    def run(self):
        # Installing required packages, running egg_info and build_ext are
        # part of normal operation for setuptools.command.test.test
        if self.distribution.install_requires:
            self.distribution.fetch_build_eggs(
                self.distribution.install_requires)
        if self.distribution.tests_require:
            self.distribution.fetch_build_eggs(self.distribution.tests_require)
        if self.xunit_output:
            self.distribution.fetch_build_eggs(["unittest-xml-reporting"])
        self.run_command('egg_info')
        build_ext_cmd = self.reinitialize_command('build_ext')
        build_ext_cmd.inplace = 1
        self.run_command('build_ext')

        # Construct a TextTestRunner directly from the unittest imported from
        # test, which creates a TestResult that supports the 'addSkip' method.
        # setuptools will by default create a TextTestRunner that uses the old
        # TestResult class.
        from test import unittest, PymongoTestRunner, test_cases
        if self.test_suite is None:
            all_tests = unittest.defaultTestLoader.discover(self.test_module)
            suite = unittest.TestSuite()
            suite.addTests(
                sorted(test_cases(all_tests), key=lambda x: x.__module__))
        else:
            suite = unittest.defaultTestLoader.loadTestsFromName(
                self.test_suite)
        if self.xunit_output:
            from xmlrunner import XMLTestRunner
            runner = XMLTestRunner(verbosity=2,
                                   failfast=self.failfast,
                                   output=self.xunit_output)
        else:
            runner = PymongoTestRunner(verbosity=2, failfast=self.failfast)
        result = runner.run(suite)
        sys.exit(not result.wasSuccessful())
コード例 #4
0
    def run(self):
        # Installing required packages, running egg_info and build_ext are
        # part of normal operation for setuptools.command.test.test
        if self.distribution.install_requires:
            self.distribution.fetch_build_eggs(
                self.distribution.install_requires)
        if self.distribution.tests_require:
            self.distribution.fetch_build_eggs(self.distribution.tests_require)
        if self.xunit_output:
            self.distribution.fetch_build_eggs(["unittest-xml-reporting"])
        self.run_command('egg_info')
        build_ext_cmd = self.reinitialize_command('build_ext')
        build_ext_cmd.inplace = 1
        self.run_command('build_ext')

        # Construct a TextTestRunner directly from the unittest imported from
        # test, which creates a TestResult that supports the 'addSkip' method.
        # setuptools will by default create a TextTestRunner that uses the old
        # TestResult class.
        from test import unittest, PymongoTestRunner, test_cases
        if self.test_suite is None:
            all_tests = unittest.defaultTestLoader.discover(self.test_module)
            suite = unittest.TestSuite()
            suite.addTests(sorted(test_cases(all_tests),
                                  key=lambda x: x.__module__))
        else:
            suite = unittest.defaultTestLoader.loadTestsFromName(
                self.test_suite)
        if self.xunit_output:
            from xmlrunner import XMLTestRunner
            runner = XMLTestRunner(verbosity=2, failfast=self.failfast,
                                   output=self.xunit_output)
        else:
            runner = PymongoTestRunner(verbosity=2, failfast=self.failfast)
        result = runner.run(suite)
        sys.exit(not result.wasSuccessful())