What is a good approach for unit testing? #1632
Unanswered
mmartinortiz
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
For something like a Caddyfile, I'd recommend separating the config-generation logic into plain Python functions and testing those directly with pytest — keeps pyinfra out of the test entirely. For smoke-testing that the full deploy runs without errors, pyinfra has a For full end-to-end, you can spin up a throwaway Docker container and run pyinfra against it with |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I started recently to use PyInfra. So far I just use it for small things, provisioning some toy remote servers. If I want to feel confident with bigger changes, I prefer to have some tests in place.
My idea is to use
pytestfor testing that "things work as expected". For example, if I write a function that populates a Caddyfile and writes entries to work as a reverse proxy, how could I test that the file is correctly generated?. I can imagine that every operation has its peculiarities.Cheers,
Manuel
Beta Was this translation helpful? Give feedback.
All reactions