def run_features(self, *features, **kwargs): """ Run the specified features. """ # named keyword args and variable positional args aren't supported on # Python 2 verbosity = kwargs.get('verbosity') stream = kwargs.get('stream') force_color = kwargs.get('force_color', False) if stream is None and isinstance(sys.stdout, CAPTURED_OUTPUTS): # Don't show results of running the inner tests if the outer Nose # redirects output stream = str_io() CALLBACK_REGISTRY.clear(priority_class=PriorityClass.USER) STEP_REGISTRY.clear() world.__dict__.clear() argv = ['aloe'] if verbosity: argv += ['--verbosity', str(verbosity)] if force_color: argv += ['--color'] argv += list(features) return TestRunner(exit=False, argv=argv, stream=stream)
def run_features(self, *args, **kwargs): """ Run the specified features. """ # named keyword args and variable positional args aren't supported on # Python 2 verbosity = kwargs.get('verbosity') stream = kwargs.get('stream') force_color = kwargs.get('force_color', False) if stream is None: # redirects output stream = StreamTestWrapperIO() # Reset the state of callbacks and steps so that individual tests don't # affect each other CALLBACK_REGISTRY.clear(priority_class=PriorityClass.USER) STEP_REGISTRY.clear() world.__dict__.clear() old_stdout = sys.stdout sys.stdout = stream result = self.testdir.inline_run(*args, plugins=["pytest_eucalyptus"]) sys.stdout = old_stdout return TestResult(result, stream);
def run_features(self, *features, **kwargs): """ Run the specified features. """ # named keyword args and variable positional args aren't supported on # Python 2 verbosity = kwargs.get('verbosity') stream = kwargs.get('stream') force_color = kwargs.get('force_color', False) if stream is None and isinstance(sys.stdout, CAPTURED_OUTPUTS): # Don't show results of running the inner tests if the outer Nose # redirects output stream = TestWrapperIO() # Reset the state of callbacks and steps so that individual tests don't # affect each other CALLBACK_REGISTRY.clear(priority_class=PriorityClass.USER) STEP_REGISTRY.clear() world.__dict__.clear() argv = ['aloe'] if verbosity: argv += ['--verbosity', str(verbosity)] if force_color: argv += ['--color'] argv += list(features) # Save the loaded module list to restore later old_modules = set(sys.modules.keys()) result = TestRunner(exit=False, argv=argv, stream=stream) result.captured_stream = stream # To avoid affecting the (outer) testsuite and its subsequent tests, # unload all modules that were newly loaded. This also ensures that they # are loaded again for the next tests, registering relevant steps and # hooks. new_modules = set(sys.modules.keys()) for module_name in new_modules - old_modules: del sys.modules[module_name] return result