bmispelon,
@bmispelon@mastodon.social avatar
benjaoming,
@benjaoming@social.data.coop avatar

@bmispelon thanks for sharing! have you had a chance to look at model bakery for your use case? https://github.com/model-bakers/model_bakery

bmispelon,
@bmispelon@mastodon.social avatar

@benjaoming all the projects I've worked with used factory boy, Soni never had a chance to try that one. Would you recommend it?

benjaoming,
@benjaoming@social.data.coop avatar

@bmispelon I don't remember trying it, but while reading about it now, I think that the slogan "smart fixtures for better tests" (which it inherited from model-mommy) can make sense.

josh,
@josh@joshthomas.dev avatar
ghickman,
@ghickman@mastodon.social avatar

@josh @benjaoming @bmispelon what features or parts of model bakery do you prefer to Factory Boy?

josh,
@josh@joshthomas.dev avatar

@ghickman @benjaoming @bmispelon Not having to define factories for every model, hands down. Calling baker.make("myapp.MyModel") is all you ever need.

webology,
@webology@mastodon.social avatar

@josh @ghickman @benjaoming @bmispelon If you are fully into pytest + pytest.fixtures, model-bakery hits a sweet spot.

If you aren't there yet or sold on pytest + pytest.fixtures then you'll probably shrug.

ghickman,
@ghickman@mastodon.social avatar

@webology @josh @benjaoming @bmispelon definitely sold on them, and I typically build fixtures with factories, so I’m super curious to hear more about y’all’s workflows 😊 (happy to be pointed to examples if that’s easier!)

I get the impression there might be something in there for me when I don’t want to/can’t build factories for loads of models for whatever reason 🤞

josh,
@josh@joshthomas.dev avatar

@ghickman @webology @benjaoming @bmispelon Unfortunately all the interesting examples I have aren't public. I'll see if I can throw something in a gist at some point today.

josh,
@josh@joshthomas.dev avatar
josh,
@josh@joshthomas.dev avatar

@ghickman @webology @benjaoming @bmispelon Of course, just one model on it's own isn't super interesting, but if you extrapolate out for a project that has a dozen (or dozens) of Models, those extra files add up. Since I'm already all in on the pytest fixture train, just defining them once there saves that overhead. Plus the flexibility of adding kwargs to the baker.make call anywhere whenever I need it.

josh,
@josh@joshthomas.dev avatar

@ghickman @webology @benjaoming @bmispelon six of one, half dozen of the other.. Both are great libraries for accomplishing essentially the same thing, I just happen to like the little bit of extra flexibility and less boilerplate that model-bakery gives you.

josh,
@josh@joshthomas.dev avatar

@ghickman @webology @benjaoming @bmispelon On top of the fact that if you really need or miss the factory pattern, there are Recipes within model-bakery that can do that for you as well

ghickman,
@ghickman@mastodon.social avatar

@josh @webology @benjaoming @bmispelon that's a really useful comparison, thank you!

hvdklauw,
@hvdklauw@mastodon.social avatar

@bmispelon nice, use factoryboy a lot and usually I create a ArticleNoAuthor factory, then extend it and add the author there, but this is much nicer!

webology,
@webology@mastodon.social avatar

@bmispelon I really like that you are blogging. It's fun to wake up and see some of that writing/blog energy flowing.

bmispelon,
@bmispelon@mastodon.social avatar

@webology Thanks!

It's something that's been on the back of my mind for a few years now, but your daily blogging in February really motivated me to actually start doing it.

So really you only have yourself to blame 😁

webology,
@webology@mastodon.social avatar

@bmispelon Yay, I'm sorry to be a bad influence.

bmispelon,
@bmispelon@mastodon.social avatar

@webology hashtag sorry not sorry

  • All
  • Subscribed
  • Moderated
  • Favorites
  • django
  • DreamBathrooms
  • magazineikmin
  • cubers
  • InstantRegret
  • cisconetworking
  • Youngstown
  • vwfavf
  • slotface
  • Durango
  • rosin
  • everett
  • kavyap
  • thenastyranch
  • mdbf
  • megavids
  • khanakhh
  • modclub
  • tester
  • ethstaker
  • osvaldo12
  • GTA5RPClips
  • ngwrru68w68
  • Leos
  • anitta
  • tacticalgear
  • normalnudes
  • provamag3
  • JUstTest
  • All magazines