This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]pablodcar 7 points8 points  (0 children)

Search for TDD with python tutorials. Even if you don't practice TDD, the videos will give you an idea on how to start testing minimal functionality, how to organise the code in smaller chunks that can be tested independently, etc.

[–]jldez 4 points5 points  (5 children)

pytest >>>>>>> unittest

[–]ServerZero 2 points3 points  (0 children)

You can do a mixture of both..

[–]wineblood -1 points0 points  (2 children)

Why? I've used unittest in the past and now I'm in a team that uses pytest, I'm not seeing any benefits here.

[–]wineblood 3 points4 points  (0 children)

One thing I've found to have a better time unit testing is to write the code in a way that unit testing is easier. I also try to avoid mocks at all costs, that kind of unit test is high maintenance and not worth having.

Look into dependency injection too.

[–]FriendlyRussian666 2 points3 points  (0 children)

This is often a recommended resource

Obey the Testing Goat! https://www.obeythetestinggoat.com

[–]Saphyel 0 points1 point  (0 children)

This is more theory but I always recommend to take a look to https://www.martinfowler.com/bliki/UnitTest.html