I'm looking for a reasonable way to write automated tests for pyinfra code
05:14 26 Mar 2026

Do you write automated tests for your pyinfra code? What does that look like?

I'm getting start with pyinfra and now have a custom fact, a few custom operations and a pretty long deploy file. It seems wise to have some automated tests.

When I look at https://github.com/pyinfra-dev/pyinfra/blob/3.x/tests/test_operations.py, I see an awful lot of complexity with test generators and searching for code to test. I expect that is reasonable for pyinfra itself, but for my smaller use case I lean towards something a little more explicit.

pyinfra