Brian Okken, “Python Testing with Pytest“ (★★☆☆☆)
It has been a long time since I do not understand programming without testing. When I did learn Python using the JetBrains Academy, I was missing my TDD approach, so I needed to learn the basics of testing in Python before going on with the exercises. I did it using this book. I read those chapters that I needed to get acquainted with the minimum set-up to have a working testing harness. Then I stopped reading.
Now I needed to work on an entirely new package, and I decided to read the book, create my notes for the future, and do proper testing on my python work.
After reading it, I can say that the book does the job, and that is it. No theory about testing and not deep dive into the internals of any tools. It goes direct to what tools pytest
offers for the python tester. That is fantastic if you want to get going faster and bad if you need to understand the concepts behind or even get right the testing philosophy of the tool. Eventually, I will read the whole set of documentation on the pytest.org
site.
I found several poor points:
- The indexation of the code in the whole book is terrible to the point of being unreadable.
- chapter 2 about testing a package is poorly explained on the interaction between the test and the package. It took me a while to realize that you are directly testing the package, not the code.
- Appending 4 about packaging. Oh my! I did understand nothing on that one, and I had to read many other sources to know how a package works.
- Appendix 1 about virtual environments. Come on! You can not just give the instruction without explaining the concept!
In general, I’m finding that the documentation in the python environment, books, articles, and even official documentation is poorly written compared to the Ruby world. All I read about ruby, and I read a lot, is more carefully written and more balanced. Of course, this is just my opinion, and it could be biased, but it is something that I face every time. Anyway, I’ll keep reading books about Python this year. I have two more already in the queue!