def run_suite(self, suite, **kwargs): if hasattr(settings, "TEST_RUNNER" ) and "NoseTestSuiteRunner" in settings.TEST_RUNNER: from django_nose.plugin import DjangoSetUpPlugin, ResultPlugin from django_nose.runner import _get_plugins_from_settings from nose.config import Config import nose result_plugin = ResultPlugin() plugins_to_add = [DjangoSetUpPlugin(self), result_plugin] config = Config(plugins=nose.core.DefaultPluginManager()) config.plugins.addPlugins(extraplugins=plugins_to_add) for plugin in _get_plugins_from_settings(): plugins_to_add.append(plugin) nose.core.TestProgram(argv=suite, exit=False, addplugins=plugins_to_add, testRunner=TeamcityNoseRunner(config=config)) return result_plugin.result else: self.options.update(kwargs) return TeamcityTestRunner.run(self, suite, **self.options)
def plugin(self): if self._plugin == None: from django_nose.runner import NoseTestSuiteRunner from django_nose.plugin import DjangoSetUpPlugin runner = NoseTestSuiteRunner() self._plugin = DjangoSetUpPlugin(runner) return self._plugin
def run_suite(self, nose_argv): signals.before_suite_run.send(sender=self) result_plugin = ResultPlugin() plugins_to_add = [ DjangoSetUpPlugin(self), result_plugin, TestReorderer() ] for plugin in _get_plugins_from_settings(): plugins_to_add.append(plugin) cfg_files = all_config_files() manager = DefaultPluginManager() config = Config(env=os.environ, files=cfg_files, plugins=manager) config.plugins.addPlugins(plugins=plugins_to_add) text_test_runner = XMLTextNoseTestRunner(config=config, verbosity=self.verbosity) nose.core.TestProgram(argv=nose_argv, exit=False, config=config, testRunner=text_test_runner) result = result_plugin.result if self.with_reports: result.dump_xml(self.output_dir) signals.after_suite_run.send(sender=self) return result
def run_suite(self, nose_argv): result_plugin = ResultPlugin() plugins_to_add = [DjangoSetUpPlugin(self), result_plugin] for plugin in _get_plugins_from_settings(): plugins_to_add.append(plugin) nose.core.TestProgram(argv=nose_argv, exit=False, addplugins=plugins_to_add) return result_plugin.result
def run_suite(self, nose_argv): """Run the test suite.""" result_plugin = ResultPlugin() plugins_to_add = [DjangoSetUpPlugin(self), result_plugin, TestReorderer()] for plugin in _get_plugins_from_settings(): plugins_to_add.append(plugin) setup() nose.core.TestProgram(argv=nose_argv, exit=False, addplugins=plugins_to_add) return result_plugin.result
def run_suite(self, nose_argv): set_up_plugin = DjangoSetUpPlugin(self) result_plugin = ResultPlugin() plugins_to_add = [set_up_plugin, result_plugin, TestReorderer()] for plugin in _get_plugins_from_settings(): plugins_to_add.append(plugin) try: django.setup() except AttributeError: # Setup isn't necessary in Django < 1.7 pass try: nose.core.TestProgram(argv=nose_argv, exit=False, addplugins=plugins_to_add) except SystemExit as e: set_up_plugin.finalize(None) sys.exit(e.code) return result_plugin.result
def run_suite(self, nose_argv): """ Use Gherkin main program to run Nose. """ # Django-nose, upon seeing '-n', copies it to nose_argv but not its # argument (e.g. -n 1) scenario_indices = [] for i, arg in enumerate(sys.argv): if arg == '-n': try: scenario_indices.append(sys.argv[i + 1]) except KeyError: # -n was last? Nose will complain later pass # Remove lone '-n' nose_argv = [arg for arg in nose_argv if arg != '-n'] # Put the indices back into nose_argv for indices in scenario_indices: nose_argv += ['-n', indices] result_plugin = ResultPlugin() plugins_to_add = [ DjangoSetUpPlugin(self), result_plugin, TestReorderer() ] for plugin in _get_plugins_from_settings(): plugins_to_add.append(plugin) try: django.setup() # pylint:disable=no-member except AttributeError: # Setup isn't necessary in Django < 1.7 pass # Set up Gherkin test subclass test_class = getattr(django.conf.settings, 'GHERKIN_TEST_CLASS', 'aloe_django.TestCase') env = os.environ.copy() env['NOSE_GHERKIN_CLASS'] = test_class Runner(argv=nose_argv, exit=False, addplugins=plugins_to_add, env=env) return result_plugin.result
def run_suite(self, nose_argv): result_plugin = ResultPlugin() plugins_to_add = [DjangoSetUpPlugin(self), result_plugin, TestReorderer()] for plugin in _get_plugins_from_settings(): plugins_to_add.append(plugin) try: django.setup() except AttributeError: # Setup isn't necessary in Django < 1.7 pass nose.core.TestProgram(argv=nose_argv, exit=False, addplugins=plugins_to_add) return result_plugin.result
def run_suite(self, suite, **kwargs): if hasattr(settings, "TEST_RUNNER" ) and "NoseTestSuiteRunner" in settings.TEST_RUNNER: from django_nose.plugin import DjangoSetUpPlugin, ResultPlugin from django_nose.runner import _get_plugins_from_settings from nose.plugins.manager import PluginManager from nose.config import Config import nose config = Config(plugins=PluginManager()) config.plugins.loadPlugins() result_plugin = ResultPlugin() config.plugins.addPlugin(DjangoSetUpPlugin(self)) config.plugins.addPlugin(result_plugin) for plugin in _get_plugins_from_settings(): config.plugins.addPlugin(plugin) nose.core.TestProgram(argv=suite, exit=False, testRunner=TeamcityNoseRunner(config=config)) return result_plugin.result else: return TeamcityTestRunner.run(self, suite, **kwargs)
def run_suite(self, nose_argv): """Run the test suite.""" result_plugin = ResultPlugin() plugins_to_add = [ DjangoSetUpPlugin(self), result_plugin, TestReorderer() ] for plugin in _get_plugins_from_settings(): plugins_to_add.append(plugin) try: import django django.setup() except AttributeError: # Setup isn't necessary in Django < 1.7 pass self.test_program(argv=nose_argv, exit=False, addplugins=plugins_to_add, testRunner=DjangoNoseTextTestRunner) self.close_browsers() return result_plugin.result
def run_suite(self, nose_argv): """ Use Gherkin main program to run Nose. """ result_plugin = ResultPlugin() plugins_to_add = [ DjangoSetUpPlugin(self), result_plugin, TestReorderer() ] for plugin in _get_plugins_from_settings(): plugins_to_add.append(plugin) django.setup() # Set up Gherkin test subclass test_class = getattr(django.conf.settings, 'GHERKIN_TEST_CLASS', 'aloe_django.TestCase') env = os.environ.copy() env['NOSE_GHERKIN_CLASS'] = test_class Runner(argv=nose_argv, exit=False, addplugins=plugins_to_add, env=env) return result_plugin.result