Skip to content

Draft: Introduces polyfactory to replace our homegrown builders

Brendan McCollam requested to merge polyfactory into btn-2086-reduce-boilerplate

I think the idea of using the factory pattern to avoid brittle, handwritten test fixtures is a good one, but I don't love having to carry around so much boilerplate* code in tests/unit/ska_tmc_cdm/builders

There are libraries that will do this for us! Let's use them! This is a draft MR example for discussion, using Polyfactory a modern library that evolved from pydantic-factories. There are other, older, more mature libraries that do substantially the same thing, for example Factory Boy, so we could use of them if we don't trust polyfactory.

* are you noticing a theme to these MRs? Boilerplate kicked my puppy and I've been out for revenge ever since.

Merge request reports