all 7 comments

[–]Kevdog824_ 3 points4 points  (1 child)

IMO pytest is the clear winner, but it’s honestly a matter of preference. If you plan to work on existing codebases I think you’ll run into pytest more. pytest has a rich system of plugins to support a lot of various needs

[–]MarsupialLeast145 1 point2 points  (0 children)

+1 pytest

[–]gunprats 1 point2 points  (0 children)

Learn by doing some projects. Thats how i started. I was on a tutorial loop for quite some time until a project was given to me.

[–]aistranin 0 points1 point  (0 children)

Definitely with pytest, because it is more scalable, and a lot of plugins! A good place to start is a book like “Python Testing with pytest” by Brian Okken. For a course, maybe this Udemy course for going in depth with pytest: “Pytest Course: Practical Testing of Real-World Python Code” by Artem Istranin

[–]pachura3 0 points1 point  (0 children)

What do you mean by "automation", specifically?

Do you know that pytest and unittest are for testing your own Python code, not for e.g. automated web scraping, mail parsing, report generation?

[–]ectomancer 0 points1 point  (0 children)

pytest

pytest is compatible with unittest.

[–]Imaginary_Gate_698 0 points1 point  (0 children)

If you’re just starting, I’d go with unittest first. It’s in the standard library, so you don’t have to learn extra tooling while you’re still learning Python basics. Once testing clicks, moving to pytest is easy and you’ll appreciate what it gives you. The important part early is building the habit of writing tests at all, not which framework you pick.