Better error messages in pyfit 0.8a2

View: New views
4 Messages — Rating Filter:   Alert me  

Better error messages in pyfit 0.8a2

by Matt Curtis-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

For the longest time, we've been getting misleading exceptions in
PyFIT when a fixture module fails to import (because it's missing or
due to a Python syntax error) or construct (because the fixture's
__init__() raises an exception).

I've made a small patch which solves this. It's small and possibly
useful for others, so I'm including it here.

We're using PyFIT 0.8a2. I'm not sure if this patch is relevant for
later versions, but I'd be happy if someone would let me know.

The patch is for fit/Fixture.py

cheers,
Matt


Index: Fixture.py
===================================================================
RCS file: /import/cvs/pyfit/fit/fit/Fixture.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -w -u -r1.2 -r1.3
--- Fixture.py  5 Mar 2009 23:32:19 -0000       1.2
+++ Fixture.py  4 Nov 2009 05:19:28 -0000       1.3
@@ -204,7 +204,24 @@

     def getLinkedFixtureWithArgs(self, tables):
         header = self.fixtureName(tables).text()
-        fixture = self.loadFixture(header)()
+        fixture_class = header
+        try:
+            fixture_class = self.loadFixture(header)
+            fixture = fixture_class()
+        except Exception, e:
+            print '--------------------------------'
+            print 'Exception constructing %s:' % fixture_class
+            tb = traceback.format_exc()
+            print tb
+
+            class DummyFixture(object):
+                def doTable(self, *args, **kwargs):
+                    raise FitFailureException(e)
+
+            # Raising the exception is deferred to a dummy fixture's
doTable so the
+            # rest of the table doesn't fail too.
+            return DummyFixture()
+
         self.injectDependenciesIntoFixture(fixture, tables)
         return fixture

Re: Better error messages in pyfit 0.8a2

by John Roth-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Python FIT is currently homeless. If someone would like to pick
it up and begin maintaining it, I would be happy to offer any insight
as to what I was thinking when I did certain things -- assuming I
remember, and it's not a case of "I thought it was a good idea at
the time".

Unfortunately, a disk crash eliminated all of my latest work on it,
and I'm not really in a good position to pick it up again.

John Roth
ex Python FIT


Matt Curtis wrote:

>  
>
> Hi,
>
> For the longest time, we've been getting misleading exceptions in
> PyFIT when a fixture module fails to import (because it's missing or
> due to a Python syntax error) or construct (because the fixture's
> __init__() raises an exception).
>
> I've made a small patch which solves this. It's small and possibly
> useful for others, so I'm including it here.
>
> We're using PyFIT 0.8a2. I'm not sure if this patch is relevant for
> later versions, but I'd be happy if someone would let me know.
>
> The patch is for fit/Fixture.py
>
> cheers,
> Matt
>


Re: Better error messages in pyfit 0.8a2

by Matt Curtis-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi John,

I'd be happy to pick it up. I think there's a later version than 0.8a2, or should I go with that?

cheers,
Matt


--- In fitnesse@..., John Roth <JohnRoth1@...> wrote:

>
> Python FIT is currently homeless. If someone would like to pick
> it up and begin maintaining it, I would be happy to offer any insight
> as to what I was thinking when I did certain things -- assuming I
> remember, and it's not a case of "I thought it was a good idea at
> the time".
>
> Unfortunately, a disk crash eliminated all of my latest work on it,
> and I'm not really in a good position to pick it up again.
>
> John Roth
> ex Python FIT
>
>
> Matt Curtis wrote:
> >  
> >
> > Hi,
> >
> > For the longest time, we've been getting misleading exceptions in
> > PyFIT when a fixture module fails to import (because it's missing or
> > due to a Python syntax error) or construct (because the fixture's
> > __init__() raises an exception).
> >
> > I've made a small patch which solves this. It's small and possibly
> > useful for others, so I'm including it here.
> >
> > We're using PyFIT 0.8a2. I'm not sure if this patch is relevant for
> > later versions, but I'd be happy if someone would let me know.
> >
> > The patch is for fit/Fixture.py
> >
> > cheers,
> > Matt
> >
>



Re: Re: Better error messages in pyfit 0.8a2

by John Roth-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

razorbak_9 wrote:
>
> Hi John,
>
> I'd be happy to pick it up. I think there's a later version than
> 0.8a2, or should I go with that?
>
> cheers,
> Matt
>

There was an 0.8a3, but it had a minor install problem and
eventually got deleted from the Cheese Shop (I think.) You
might be able to get it from someone who has it.

John Roth



>
> --- In fitnesse@... <mailto:fitnesse%40yahoogroups.com>,
> John Roth <JohnRoth1@...> wrote:
> >
> > Python FIT is currently homeless. If someone would like to pick
> > it up and begin maintaining it, I would be happy to offer any insight
> > as to what I was thinking when I did certain things -- assuming I
> > remember, and it's not a case of "I thought it was a good idea at
> > the time".
> >
> > Unfortunately, a disk crash eliminated all of my latest work on it,
> > and I'm not really in a good position to pick it up again.
> >
> > John Roth
> > ex Python FIT
> >
> >
> > Matt Curtis wrote:
> > >
> > >
> > > Hi,
> > >
> > > For the longest time, we've been getting misleading exceptions in
> > > PyFIT when a fixture module fails to import (because it's missing or
> > > due to a Python syntax error) or construct (because the fixture's
> > > __init__() raises an exception).
> > >
> > > I've made a small patch which solves this. It's small and possibly
> > > useful for others, so I'm including it here.
> > >
> > > We're using PyFIT 0.8a2. I'm not sure if this patch is relevant for
> > > later versions, but I'd be happy if someone would let me know.
> > >
> > > The patch is for fit/Fixture.py
> > >
> > > cheers,
> > > Matt
> > >
> >
>
>



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/fitnesse/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/fitnesse/join
    (Yahoo! ID required)

<*> To change settings via email:
    fitnesse-digest@...
    fitnesse-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    fitnesse-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/