Are there any guidelines for writing test-friendly Python code?
What I believe:

One method does one thing.
Don't use side-effects.

Any other suggestions?
Alfred‘s answer is great, but I would add one thing for the questioner: 
If you want to read a book, that is all about testing in Python using pytest, I suggest you to read „Python Testing with pytest: Simple, Rapid, Effective, and Scalable“ by Brian Okken. It’s perfect for what you want to do and it’s brand new (published September 2017).
Any tips on writing testing-friendly code?