twisted.scripts.trial._getSuite

Here are the examples of the python api twisted.scripts.trial._getSuite taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

7 Examples 7

Example 1

Project: nodeset.core Source File: __init__.py
    def loadTestsFromNames(self, test_suite, wtf):
        config = Options()
        config.parseOptions(test_suite)
                                
        trialRunner = _makeRunner(config)
        suite = _getSuite(config)
        if config['until-failure']:
            test_result = trialRunner.runUntilFailure(suite)
        else:
            test_result = trialRunner.run(suite)
        if config.tracer:
            sys.settrace(None)
            results = config.tracer.results()
            results.write_results(show_missing=1, summary=False,
                                  coverdir=config.coverdir)
            
        sys.exit(not test_result.wasSuccessful())

Example 2

Project: mythbox Source File: test_script.py
    def test_testmoduleOnModule(self):
        """
        Check that --testmodule loads a suite which contains the tests
        referred to in test-case-name inside its parameter.
        """
        self.config.opt_testmodule(sibpath('moduletest.py'))
        self.assertSuitesEqual(trial._getSuite(self.config),
                               ['twisted.trial.test.test_test_visitor'])

Example 3

Project: mythbox Source File: test_script.py
    def test_testmoduleTwice(self):
        """
        When the same module is specified with two --testmodule flags, it
        should only appear once in the suite.
        """
        self.config.opt_testmodule(sibpath('moduletest.py'))
        self.config.opt_testmodule(sibpath('moduletest.py'))
        self.assertSuitesEqual(trial._getSuite(self.config),
                               ['twisted.trial.test.test_test_visitor'])

Example 4

Project: mythbox Source File: test_script.py
    def test_testmoduleOnSourceAndTarget(self):
        """
        If --testmodule is specified twice, once for module A and once for
        a module which refers to module A, then make sure module A is only
        added once.
        """
        self.config.opt_testmodule(sibpath('moduletest.py'))
        self.config.opt_testmodule(sibpath('test_test_visitor.py'))
        self.assertSuitesEqual(trial._getSuite(self.config),
                               ['twisted.trial.test.test_test_visitor'])

Example 5

Project: mythbox Source File: test_script.py
    def test_testmoduleOnSelfModule(self):
        """
        When given a module that refers to *itself* in the test-case-name
        variable, check that --testmodule only adds the tests once.
        """
        self.config.opt_testmodule(sibpath('moduleself.py'))
        self.assertSuitesEqual(trial._getSuite(self.config),
                               ['twisted.trial.test.moduleself'])

Example 6

Project: mythbox Source File: test_script.py
    def test_testmoduleOnScript(self):
        """
        Check that --testmodule loads tests referred to in test-case-name
        buffer variables.
        """
        self.config.opt_testmodule(sibpath('scripttest.py'))
        self.assertSuitesEqual(trial._getSuite(self.config),
                               ['twisted.trial.test.test_test_visitor',
                                'twisted.trial.test.test_class'])

Example 7

Project: parallel-django-and-twisted-test-runner Source File: runner.py
    def _tests_func(self, tests, worker_index):
        if not isinstance(tests, (list, set)):
            tests = [ tests ]

        args = [ '-e' ]
        args.extend(tests)

        config = Options()
        config.parseOptions(args)

        stream = BufferWritesDevice()
        runner = self._make_runner(config=config, stream=stream)
        suite = _getSuite(config)
        result = setup_test_db(worker_index, None, runner.run, suite)
        result = TestResult().from_trial_result(result)
        return result