[omaha] Django Model patterns

Mike Hostetler mike at squarepegsystems.com
Thu Feb 20 04:02:13 CET 2014


I was just thinking the other day, "It seems like Python 3 is the new Perl
6." Let's hope I'm wrong. And it appears that I may be. But I still use
Python 2.x.

Back to Model testing... I was told by, you boss to do a ton of changes in
3 days for a demo. So tests took a back seat and I just, are things work.

After the demo, I decided my first step was to get the tests to run. But I
did a tin of migrations with South and none of my JSON fixtures would run.
I found factoryboy and wrote a script to take my JSON and put it into CSV
files. Then I wrote a  model called "mocker"  that loaded those CSV files
into the test database using factoryboy. That way I still had my various
bits of data I wrote tests for but in a more flexible format.

I agree with Jeff - model_mommy doesn't really have anything that
factoryboy doesn't seem to have. Both were based in the same Ruby libs. A
document or a presentation putting them head to head would be interesting.
On Feb 19, 2014 7:49 PM, "Jay Bendon" <jaybocc2 at gmail.com> wrote:

> Side topic ahoy!
>
> As we get 2.x closer to 3.x The migration continues to get easier.  Code is
> drastically different from 2.7 than it was from 2.4 or even 2.5.  I
> understand the desire for 3.x to be significantly better than 2.x but as
> long as the transition is simple and smooth it shouldn't matter that much.
>
> Just please don't follow perls example. :)
>
> --Jay
>
>
> On Wed, Feb 19, 2014 at 5:42 PM, Jeff Hinrichs - DM&T <jeffh at dundeemt.com
> >wrote:
>
> > they appear to be solving the same problem, it isn't clear after a
> cursory
> > glance what model_mommy is trying to do that factoryboy doesn't/can't.
> >
> > factoryboy serves me well.  When I change or add tools, I expect a 10x
> > improvement.  FactoryBoy did that over fixtures (and a lot more)
> >  model_mommy may do the same over fixtures but not over factoryboy.  So
> > unless I see a presentation on why model_mommy is significantly better
> than
> > factoryboy -  I view it as a time sink to change.  Also, docs are quite
> > good on factoryboy and once you start using it, it is easy to remember.
>  It
> > just makes sense once you grok it.
> >
> > Always be open to change, but demand that the change bring a 10x
> > improvement.  That is what is hurting python 3.x adoption. It is better
> > than 2.x but only incrementally with large hurdles - code and 3rd party
> > tools migration.
> >
> > these opinions are worth their market value, $0.00000001
> >
> > what say you?
> >
> > Best,
> > Jeff
> >
> >
> > On Wed, Feb 19, 2014 at 6:44 PM, Steve Young <wereapwhatwesow at gmail.com
> > >wrote:
> >
> > > factoryboy is nice!  How about
> > > https://github.com/vandersonmota/model_mommy?
> > >
> > >
> > > Steve
> > >
> > >
> > > On Wed, Feb 19, 2014 at 6:28 PM, Jeff Hinrichs - DM&T <
> > jeffh at dundeemt.com
> > > >wrote:
> > >
> > > > factoryboy ++1
> > > >
> > > > wouldn't go back to anything else.   Makes testing taste great.  json
> > > > importing is all crunchy, dry and brittle by comparison.   That +
> > > > migrations (nee south) makes db refactoring less sucky. Still isn't
> as
> > > good
> > > > as I would like to see db refactoring, but it is less like hard
> > concrete
> > > > and more like wet sand with these tools.
> > > >
> > > >
> > > > On Wed, Feb 19, 2014 at 6:19 PM, Wes Turner <wes.turner at gmail.com>
> > > wrote:
> > > >
> > > > > On 2/19/14, Mike Hostetler <mike at squarepegsystems.com> wrote:
> > > > > > I'm getting ready to start a new Django project -- this is good
> > > stuff.
> > > > > And
> > > > > > Wes added some great links too.
> > > > > >
> > > > > > I did move a bunch of Django fixtures from the "traditional" JSON
> > > > > importing
> > > > > > to FactoryBoy and -- wow -- was life ever easier after that.
> > > > >
> > > > > https://factoryboy.readthedocs.org/en/latest/ ... Thanks!
> > > > > _______________________________________________
> > > > > Omaha Python Users Group mailing list
> > > > > Omaha at python.org
> > > > > https://mail.python.org/mailman/listinfo/omaha
> > > > > http://www.OmahaPython.org
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Best,
> > > >
> > > > Jeff Hinrichs
> > > > 402.218.1473
> > > > _______________________________________________
> > > > Omaha Python Users Group mailing list
> > > > Omaha at python.org
> > > > https://mail.python.org/mailman/listinfo/omaha
> > > > http://www.OmahaPython.org
> > > >
> > > _______________________________________________
> > > Omaha Python Users Group mailing list
> > > Omaha at python.org
> > > https://mail.python.org/mailman/listinfo/omaha
> > > http://www.OmahaPython.org
> > >
> >
> >
> >
> > --
> > Best,
> >
> > Jeff Hinrichs
> > 402.218.1473
> > _______________________________________________
> > Omaha Python Users Group mailing list
> > Omaha at python.org
> > https://mail.python.org/mailman/listinfo/omaha
> > http://www.OmahaPython.org
> >
> _______________________________________________
> Omaha Python Users Group mailing list
> Omaha at python.org
> https://mail.python.org/mailman/listinfo/omaha
> http://www.OmahaPython.org
>


More information about the Omaha mailing list