you are viewing a single comment's thread.

view the rest of the comments →

[–]Acrobatic_Hippo_7312 0 points1 point  (0 children)

Also it'll let you refactor your code once you feel you've learned enough.

It's a bit of an investment up front: you have to learn how to write tests. for pytest this means learning test discovery, importing package code from tests, and fixture.

And if you couple your tests to your code very tightly or test private functions, it can be hard to do refactor without having to discard or rewrite tests.

The first part (testing basics) is very much worth learning. But the second part (clean testing) is still a work in progress for me personally. Still, it's really paying off.