rlisagor / freshen

Clone of the Cucumber BDD framework for Python
GNU General Public License v3.0
359 stars 56 forks source link

Freshen should have a more nice feedback #5

Closed fsouza closed 13 years ago

fsouza commented 14 years ago

Freshen is under tests for using in Gaphor (http://gaphor.sf.net) and there was a test fail with the following output:

ERROR: Start up Gaphor: Launch the application
----------------------------------------------------------------------
ExceptionWrapper

----------------------------------------------------------------------
Ran 1 test in 0.880s

FAILED (errors=1)

This "not nice" output remains in verbose mode.

I think that Freshen can prints at least the stdout, as in unittests.

fsouza commented 14 years ago

I checked the noseplugin module and see that in FreshenNosePlugin class the formatFailure method isn't working properly and the output is not being formated.

The if in line 193 didn't returns true and the code inside the if is not executed:

def formatFailure(self, test, err):
    if hasattr(test, 'test') and isinstance(test.test, FreshenTestCase):
        ec, ev, tb = err
        if ec is ExceptionWrapper and isinstance(ev, Exception):
            orig_ec, orig_ev, orig_tb = ev.e
            return (orig_ec, str(orig_ev) + '\n\n>> in "%s" # %s' % (ev.step.match, ev.step.source_location()), orig_tb)

I am working to fix it :)

fsouza commented 14 years ago

I've done some tests and I see that the formatFailure method really doesn't works.

The second element of "err" tuple ("ev" object) is passed as a str object. Here is an example with ZeroDivisionError:

-------------------- >> begin captured stdout << --------------------- App init App init done step 1

--------------------- >> end captured stdout << ---------------------- -------------------- >> begin captured logging << -------------------- root: DEBUG: found entry point service.file_manager root: DEBUG: found entry point service.diagram_layout root: DEBUG: found entry point service.diagram_export_manager root: DEBUG: found entry point service.element_dispatcher root: DEBUG: found entry point service.sanitizer root: DEBUG: found entry point service.adapter_loader root: DEBUG: found entry point service.element_factory root: DEBUG: found entry point service.properties root: DEBUG: found entry point service.pynsource root: DEBUG: found entry point service.event_dispatcher root: DEBUG: found entry point service.undo_manager root: DEBUG: found entry point service.gui_manager root: DEBUG: found entry point service.copy root: DEBUG: found entry point service.action_manager root: DEBUG: found entry point service.xmi_export root: DEBUG: found entry point service.alignment root: DEBUG: found entry point service.help root: INFO: initializing service service.file_manager root: INFO: initializing service service.properties root: INFO: initializing service service.diagram_layout root: INFO: initializing service service.diagram_export_manager root: INFO: initializing service service.gui_manager root: INFO: Icon dir: /usr/local/lib/python2.6/dist-packages/gaphor/ui/pixmaps root: INFO: initializing service service.action_manager root: INFO: Loading not yet registered action provider services root: DEBUG: Loading already registered service <gaphor.services.filemanager.FileManager object at 0x3b85990> root: DEBUG: Registering actions for <gaphor.services.filemanager.FileManager object at 0x3b85990> root: DEBUG: Loading already registered service <gaphor.plugins.diagramlayout.DiagramLayout object at 0x3b85ad0> root: DEBUG: Registering actions for <gaphor.plugins.diagramlayout.DiagramLayout object at 0x3b85ad0> root: DEBUG: Loading already registered service <gaphor.services.diagramexportmanager.DiagramExportManager object at 0x3cd3850> root: DEBUG: Registering actions for <gaphor.services.diagramexportmanager.DiagramExportManager object at 0x3cd3850> root: DEBUG: found entry point uicomponent.mainwindow root: DEBUG: Registering actions for <gaphor.ui.mainwindow.MainWindow object at 0x3e7c6d0> root: DEBUG: found entry point uicomponent.elementeditor root: DEBUG: Registering actions for <gaphor.ui.elementeditor.ElementEditor object at 0x3e82090> root: DEBUG: found entry point uicomponent.consolewindow root: DEBUG: Registering actions for <gaphor.ui.consolewindow.ConsoleWindow object at 0x3e82390> root: INFO: initializing service service.element_factory root: INFO: initializing service service.xmi_export root: DEBUG: Loading registered service <gaphor.plugins.xmiexport.XMIExport object at 0x3d559d0> root: DEBUG: Registering actions for <gaphor.plugins.xmiexport.XMIExport object at 0x3d559d0> root: INFO: initializing service service.element_dispatcher root: INFO: initializing service service.sanitizer root: INFO: initializing service service.adapter_loader root: INFO: initializing service service.pynsource root: DEBUG: Loading registered service <gaphor.plugins.pynsource.PyNSource object at 0x3d42490> root: DEBUG: Registering actions for <gaphor.plugins.pynsource.PyNSource object at 0x3d42490> root: INFO: initializing service service.event_dispatcher root: INFO: initializing service service.undo_manager root: DEBUG: Loading registered service <gaphor.services.undomanager.UndoManager object at 0x3d495d0> root: DEBUG: Registering actions for <gaphor.services.undomanager.UndoManager object at 0x3d495d0> root: INFO: initializing service service.copy root: DEBUG: Loading registered service <gaphor.services.copyservice.CopyService object at 0x3d552d0> root: DEBUG: Registering actions for <gaphor.services.copyservice.CopyService object at 0x3d552d0> root: INFO: initializing service service.alignment root: DEBUG: Loading registered service <gaphor.plugins.alignment.Alignment object at 0x3d8d050> root: DEBUG: Registering actions for <gaphor.plugins.alignment.Alignment object at 0x3d8d050> root: INFO: initializing service service.help root: DEBUG: Loading registered service <gaphor.services.helpservice.HelpService object at 0x3d8d510> root: DEBUG: Registering actions for <gaphor.services.helpservice.HelpService object at 0x3d8d510> --------------------- >> end captured logging << ---------------------

The method expects to receive an exception instance, not a string instance.

ghost commented 13 years ago

Is this still an issue? Does the patch provided in #8 solve the issue?